Commit 2e7cbee8 authored by B.Nagasuman's avatar B.Nagasuman

Add new file

parents
int ledPin = 13;
String readString;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
Serial.println("serial on/off test 0021"); // so I can keep track
}
void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
if (readString == "on")
{
digitalWrite(ledPin, HIGH);
}
if (readString == "off")
{
digitalWrite(ledPin, LOW);
}
readString="";
}
}char incomingByte;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(D0,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0){
incomingByte=Serial.read();
if(incomingByte=='1')
{
digitalWrite(D0,HIGH);
}
else if(incomingByte=='0'){
digitalWrite(D0,LOW);
}
//say what you got:
Serial.print("I received:");
Serial.println(incomingByte,DEC);
delay(10);
}void setup() {
// initialize digital pin 16 as an output.
pinMode(16, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(16, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(16, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for 1/10 secon
}}
PROGRAM D
char IncomingByte;
//int serial;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0)
{
IncomingByte=Serial.read();
Serial.print("I HAVE RECEIVED");
Serial.println(IncomingByte,DEC);
delay(10);}
}
PROGRAM E
char incomingByte;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(D0,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0){
incomingByte=Serial.read();
if(incomingByte=='1')
{
digitalWrite(D0,HIGH);
}
else if(incomingByte=='0'){
digitalWrite(D0,LOW);
}
//say what you got:
Serial.print("I received:");
Serial.println(incomingByte,DEC);
delay(10);
}
}
PROGRAM B
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment