Electronic Components Datasheet Search
  English  ▼

X  

DFR0305 Datasheet(PDF) 6 Page - DFROBOT

Part # DFR0305
Description  RoMeo BLE (SKU:DFR0305)
PDF  18 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  DFROBOT [DFROBOT]
Direct Link  https://www.dfrobot.com/
Logo DFROBOT - DFROBOT

DFR0305 Datasheet(HTML) 6 Page - DFROBOT

Back Button DFR0305 Datasheet HTML 2Page - DFROBOT DFR0305 Datasheet HTML 3Page - DFROBOT DFR0305 Datasheet HTML 4Page - DFROBOT DFR0305 Datasheet HTML 5Page - DFROBOT DFR0305 Datasheet HTML 6Page - DFROBOT DFR0305 Datasheet HTML 7Page - DFROBOT DFR0305 Datasheet HTML 8Page - DFROBOT DFR0305 Datasheet HTML 9Page - DFROBOT DFR0305 Datasheet HTML 10Page - DFROBOT Next Button
Zoom Inzoom in Zoom Outzoom out
 6 / 18 page
background image
The code is as follows:
int led = 13;
char rcv_buf[10];
// Receive command arrays.
void setup()
{
pinMode(led, OUTPUT);
Serial.begin(115200);
}
void loop()
{
int data_len=0;
while(1)
{
while(Serial.available())
{
rcv_buf[(data_len++)%10] =Serial.read();
}
if(rcv_buf[data_len-2]== '\r' && rcv_buf[data_len-1]=='\n')
// Stop
reading the serial once getting the ending command.
break;
}
if ((data_len==4)&&(!strncmp(rcv_buf,"ON",2)))
// Open the light L
when the command is "ON".
{
digitalWrite(led, HIGH);
// Set D13 pin as high
and openg the light L
Serial.println("LIHGT ON");
}else if((data_len==5)&&(!strncmp(rcv_buf,"OFF",3)))
// Close the light L
when the command is "OFF".
{
digitalWrite(led, LOW);
// Set D13 pin as low and
the light L
Serial.println("LIHGT OFF");
}
}
if ((data_len==4)&&(!strncmp(rcv_buf,"ON",2)))
// Open the light L whe
n the command is "ON".
{
digitalWrite(led, HIGH);
// Set D13 pin as high
and openg the light L
Serial.println("LIHGT ON");
}else if((data_len==5)&&(!strncmp(rcv_buf,"OFF",3)))
// Close the light L
when the command is "OFF".
{
digitalWrite(led, LOW);
// Set D13 pin as low and
the light L
Serial.println("LIHGT OFF");
}



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com