robotboy27:
Yeah . I think LabView is more like a teaching tool . Anyway , I want to sent 1 or 0 to turn off my relay from my labView GUi to my YUN. Since TCP is all strings , how can I tell it to turn the relay on and off?
How can I code this in the IDE ? Sorry but this is quite advance for a beginner user in both platforms.Is anyone able to help me?
Load this code first:
Console Pixel example from IDE:
#include <Console.h>
const int ledPin = 13; // the pin that the LED is attached to
char incomingByte; // a variable to read incoming Console data into
void setup() {
Bridge.begin(); // Initialize Bridge
Console.begin(); // Initialize Console
while (!Console); // Wait for the Console port to connect
Console.println("type H or L to turn pin 13 on or off");
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output:
}
void loop() {
// see if there's incoming Console data:
if (Console.available() > 0) {
incomingByte = Console.read(); // read the oldest byte in the Console buffer:
Console.println(incomingByte);
if (incomingByte == 'H') {
digitalWrite(ledPin, HIGH); // if it's a capital H (ASCII 72), turn on the LED:
}
if (incomingByte == 'L') {
digitalWrite(ledPin, LOW); // if it's an L (ASCII 76) turn off the LED:
}
}
}