Blink LED

Hi everyone!

I am wondering about blink LED, can we turn on and turn off LED equal to speed of Baud Rate (115200 bit/second).
If answer is YES, How to do that?

Thanks in advance.

About every 9us?

Why do you want to do this?

You can use a timer or roughly with micros().

#include <TimerOne.h>

void setup()
{
  pinMode(9,OUTPUT);   //LED (with resistor) on pin 9, UNO
  Timer1.initialize(17);  //~59khz 
  Timer1.pwm(9,512);   //50% DC (8.5us on 8.5us off)
}

void loop()
{
}

LarryD:

#include <TimerOne.h>

void setup()
{
  pinMode(9,OUTPUT);  //LED (with resistor) on pin 9, UNO
  Timer1.initialize(17);  //~59khz
  Timer1.pwm(9,512);  //50% DC (8.5us on 8.5us off)
}

void loop()
{
}

and get your scope out if you want to observe anything!

Thank for responses.

I use Arduino Mega 2560, So which pin can be used to replace pin 9 in UNO.

Another thing, If I want to blink LED on that pin by a array of binary bits, which command can be used?

I do not have a Mega, others will chime in.

Thank for responses.

But you won't respond.

Why do you want to do this?

Hi LarryD

I have a project with VLC communication. In order to get a high performance of communication, so I have to blink LED with high frequency (it may be equal to baud rate). For example. A text is sent from Serial monitor to arduino, arduino received this string and then convert to Binary bits, a LED is used to blink based on these bits. With low frequency I use DigitalWrite to do this, it is OK but with high frequency I have not done yet.