DFRobot DFR0004 Manual page 12

Dfrduino romeo-all in one controller
Hide thumbs Also See for DFR0004:
Table of Contents

Advertisement

2018/11/27
https://www.dfrobot.com/wiki/index.php/DFRduino_Romeo-All_in_one_Controller_V1.1(SKU:DFR0004)
DFRduino Romeo-All in one Controller V1.1(SKU:DFR0004) - DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot.com
void turn_R (char a,char b)
{
analogWrite (E1,a);
digitalWrite(M1,HIGH);
analogWrite (E2,b);
digitalWrite(M2,LOW);
}
void setup(void)
{
int i;
( i=4;i<=7;i++)
f o r
pinMode(i, OUTPUT);
Serial.begin(19200);
/ / S e t B a u d R a t e
Serial.println("Run keyboard control");
}
void loop(void)
{
( Serial.available()){
i f
char val = Serial.read();
( val != -1)
i f
{
( val)
s w i t c h
{
'w':
c a s e
/ / M o v e F o r w a r d
advance (255,255);
/ / m o v e f o r w a r d i n m a x s p e e d
;
b r e a k
's':
c a s e
/ / M o v e B a c k w a r d
back_off (255,255);
/ / m o v e b a c k i n m a x s p e e d
;
b r e a k
'a':
c a s e
/ / T u r n L e f t
turn_L (100,100);
;
b r e a k
'd':
c a s e
/ / T u r n R i g h t
turn_R (100,100);
;
b r e a k
'z':
c a s e
Serial.println("Hello");
;
b r e a k
'x':
c a s e
/ / T u r n R i g h t
12/16

Advertisement

Table of Contents
loading

Table of Contents