Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char IncomingCommand[10]; // for incoming serial data
- int ledPin = 10; // select the pin for the LED
- int val = 6000; // variable to store the data upper limit
- void setup() {
- pinMode(ledPin,OUTPUT); // declare the LED's pin as output
- Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
- }
- void loop () {
- // send data only when you receive data: 83 84 65 82 84
- if (Serial.readBytesUntil(char(13), IncomingCommand, Serial.available()) > 0) {
- if (IncomingCommand == "start") {
- for(int i=0; i<val; i++) {
- digitalWrite(ledPin,HIGH);
- delay(150);
- digitalWrite(ledPin, LOW);
- delay(150);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement