Advertisement
Guest User

Untitled

a guest
May 29th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. char IncomingCommand[10]; // for incoming serial data
  2. int ledPin = 10; // select the pin for the LED
  3. int val = 6000; // variable to store the data upper limit
  4.  
  5. void setup() {
  6. pinMode(ledPin,OUTPUT); // declare the LED's pin as output
  7.  
  8. Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
  9. }
  10.  
  11. void loop () {
  12. // send data only when you receive data: 83 84 65 82 84
  13. if (Serial.readBytesUntil(char(13), IncomingCommand, Serial.available()) > 0) {
  14. if (IncomingCommand == "start") {
  15. for(int i=0; i<val; i++) {
  16. digitalWrite(ledPin,HIGH);
  17. delay(150);
  18. digitalWrite(ledPin, LOW);
  19. delay(150);
  20. }
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement