loading
 
Button
ronn0011  [73 posts]
12 year
Hi Is it possible to use button control interface to control LED, like swith on and off.
Example I create 2 button:
1 On with variable name " ON"
2 Off with variable name " OFF"

How would i assign the variable in the digital pin if i also use arduino module. I need to specified the variable of the button control interface , my problem i am not sure how to assign this.

Because i know we can on and off led by using tick and untick in " arduino module" under digital

Or is there any other simpler method like controlling on and off led by pressing keyboard input.

Anonymous 12 year
Ron,

You almost have it ... close to where you are clicking and unclicking the checkbox to change the LED is a dropdown box (first GUI element) which is where you type in the variable that will either have a 1 or 0 to change the LED state. When you select this variable it will disable the checkbox which means that the information is now under automatic control rather than manual.

If you select IMAGE_COUNT as the variable the LED will flash each time an image is processed. Since this may be very fast also select bit 4 or 5 to slow that down and blink at a rate that you can see.

STeven.
ronn0011  [73 posts] 12 year
Hi Steven

does the image_count corresponding to the "BUTTON INTERFACE" Module, Because at the Button interface there is the Variable name and I would like to Create 2 Buttons, Button 1 "START" to On the LED and Button 2 to Off the LED

so I would like to Configure my Arduino Module, I am using pin 13 which is already has an LED as an experiment and does this image count need to correspind to "BUTTON INTERFACE" Variable.

I attach the Images for Easy reference

 
Anonymous 12 year
Ron,

Correct. Variable = Variable ... see the text in both interfaces. All variables are variables, they are all from the same pool of information. You can create one in one module and use it in another.

So intead of using IMAGE_COUNT use INTERFACE_START (just type it in). Or change both to some text you can remember like "LED_PIN" or whatever. The name does not matter, where you assign it and use it does.

You can use the Watch module to see all variables at that point in the pipeline. It will show when the variable is set or not.

Also, be careful of the Bit field. You currently have that at 4 which means it is detecting the number 16 (1 << 4). So either change it to 1 or assign a value of 16 to your variable.

Note also the "Is Toggle" checkbox on the button interface. Select this to assign the value when pressed and clear when released.

Don't be afraid to just try things out!

STeven.
ronn0011  [73 posts] 12 year
Yes Thank, I am trying to toggle different ways to see the result

1. I first tried using image_count, Yes it blinking as go to higher bit, the blinking slowing down

2. I tried to assign LED_ON to both" Button & Arduino Variable "and assign bit 16 and 1 . However pressing the button, I observed the " WATCH VARIABLE" changing to expected value, However the LED does not " LIGHT UP"


The picture is the configuration



 
ronn0011  [73 posts] 12 year
Hi Steven, Pls respond to this thread once you are available :)
Anonymous 12 year
Ron,

Bit 16 = 65535. bit 4 = 16.

I suggest keeping everything at bit 1 with number 1. I.e. in the Button config set LED_ON to 1, Set bit to 1 in Arduino interface AND set it to output radio button and NOT INPUT. Input implies the module will read info from the Arduino whereas output will send information to it.

If the number do not flow with the correct values then the LED will not light. Why did you chose 16?

STeven.
ronn0011  [73 posts] 12 year
Yes, I did tried using 1 in BUTTON INTERFACE AND SPARKFUN ARDUINO PIN13  and the "WATCH DISPLAY" appeared as I pressed the Button Start, However the LED does not on.


However if i use the tick in the pin 13 by ticking it, the LED on my MEGA 2560 is ON .

I also noticed by using IMAGE COUNT bit 1, in blinking as go to higher bit like 4, the blinking slower.

I am wondering if actually the LED_ON on my BUTTON INTERFACE if it is Sync with my SPARKFUN ARDUINO's Led_On VARIABLE


Thanks.


I am also curious if you could solve my arduino Thread on The "SOUND MODULE", I have been working to create sound module using roborealm, it is about to succeed but I had no idea what caused the delay in the trigger of the keyboard input for the Music to be played.


http://www.roborealm.com/forum/index.php?thread_id=4527#

Thanks again
ronn0011  [73 posts] 12 year
Here is the pic of the setting of the WATCH VARIABLE which it seemed triggered when pressing the button it shows 1, however if it sync with arduino module, it is hard to tell as the light on my arduino Mega does not on

 
ronn0011  [73 posts] 12 year
Hi Steven Strange things happen the value has to be put around 1950 and the LED is ON now and guessing the VALUE in BUTTON INTERFACE is not referring to the BIT


Please see the image below



 
Anonymous 12 year
Ron,

My mistake, set the bit to 0 instead of 1 in the Arduino module. Bit 0 =1, Bit 1 = 2, Bit 3 = 4, etc.

Let's solve this and then move to the sound issue.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index