Introduction: Create TrackBar on You PC and Control Arduino.
Hello everyone,
Today I will show you how to create TrackBar on you PC and turn on LED13 if you scroll the TrackBar control to Position 2 (Remember: programming usually begins in 0 then it will be the third position).
what do you need:
1. arduino board.
2. you need to install Progduino (its free) - http://www.progduino.com
3. arduino code editor
1. copy the code and uplaod it to your arduino board.
int incomingByte = 0;
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
ProgduinoRunOnce();
}
void loop()
{
if (Serial.available() > 0) {
if(Serial.read() == '2'){
digitalWrite(13, HIGH);
}
else{
digitalWrite(13, LOW);
}
}
}
void ProgduinoRunOnce(){
Serial.println(F("WindowSize; width:400; height:200"));
Serial.println(F("createTrackBar; width:325; height:50; top:20; left:30; name:TrackBar1; value:9; Minimum:0; Maximum:10;"));
Serial.println(F("onScroll; control:TrackBar1; function:getData; ctrl:TrackBar1; prop:value;"));
}
2. run progduino and start scroll the control, when you get to the third position you will see the LED13 turned on.
This is just a small example and you can do with Progduino many things very easily.