13. Interfacing LED and controlling through Arduino serial communication

preview_player
Показать описание
Connecting and programming Arduino board to control LED through a serial interface.

Рекомендации по теме
Комментарии
Автор

Thanks a lot. I didn't imagine that there is a video that explains why when I introduce an interger number like 1 or 2 into Serial.read() it transform the integer into 49 or something like that ... thank you again. Please, do more video like this one.

Juanguaqueta
Автор

Thank you 🙏 A very helpful video. Extremely well explained.

onlyshantan
Автор

thanks man that help alot to be able to turn on and off my leds threw serial monter

AndrewMurphy
Автор

Great! thank you very much. Keep going with the videos

alico
Автор

I want to use a String data type, why my led does not glow in that case?

Seerat.Bashir
Автор

can u give me a simple code for turn on and shut off led by using string data?

ridwanansori
Автор

how, if we write case 1 led on, then we write again 1 led off

rezapratama
Автор

Thank you very much for this tutorial...helped a lot....appreciated.

sameerk
Автор

i did the same code exactly but in the print screen i type 1 the result show tow lines 1st is 49 and the second is 10, and every time i send number i get tow lines and the second always 10?? why please??

haidar
Автор

tnx 4 this, sir would like to ask, if i use word like hello to turn on and shut to off led, i just type this...in the case?

wrhd
Автор

excuse me sir, when i use Serial.parseInt(), Serial automatically returns to 0. how i can fix that
thanks

trungtran
Автор

If anyone here, for the solution of the " Serial automatically returns to 0" problem, the solution is right way, Enclose the number after "case:" with a single quotation '1' and upload,

(void loop() {
if (Serial.available()>0) { int rx =Serial.read();
switch (rx){case '1': Serial.println("1");
digitalWrite(13, HIGH);
break;
case '0':Serial.println("0");
digitalWrite(13, LOW);
break; } }}

alfalesta
Автор

I'm doing test to light / erase a LED through commands through the serial port.
 The problem is the following, when sending the command to turn on or off the led of pin 13 of Arduino, it takes about 1 second to execute the command (change the logical state of the port), I had found an example where I had a command that did the Arduino perform the function immediately, but I did not find this example any more.
 Do you know which command ?? I think it's something like accuracy of response time. Below is the code I am testing.
 Thanks hugs.

String incoming;
void setup ()
{
  pinMode (LED_BUILTIN, OUTPUT);
  Serial.begin (9600); // Initialize the serial
}
void loop ()
{
   if (Serial.available ()> 0)
   {
   incoming = Serial.readString ();
    if (incoming == "on")
    {
    digitalWrite (LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
    }
    if (incoming == "hangs up")
    {
    digitalWrite (LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
    }
   }
}

aparecido