daily pastebin goal
34%
SHARE
TWEET

Arduino interfacing cSharp

a guest Jan 9th, 2015 424 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define ledPin 2
  2.  
  3. void setup() {
  4.     Serial.begin(9600);
  5.     pinMode(ledPin, OUTPUT);
  6. }
  7.  
  8. void loop() {
  9.     char rx_data = Serial.read();
  10.     switch(rx_data) {
  11.         case 'ON':
  12.             digitalWrite(ledPin, HIGH);
  13.             Serial.println("Led is turned on!");
  14.             break;
  15.         case 'OFF':
  16.             ditialWrite(ledPin, LOW);
  17.             Serial.println("Led is turned off!");
  18.             break;
  19.     }
  20. }
RAW Paste Data
Top