Keywish Hummer-Bot-1.0 Instruction Manual page 99

Table of Contents

Advertisement

#include "protocol.h"
#include "hummerbot.h"
#include "process.h"
int
E1
= 5;
//PWMA
int
M1
= 9;
//DIRA --- left
int
E2
= 6;
//PWMB
int
M2
= 10;
//DIRB --- right
byte
readbuff[32] = {};
int
readlen
= 0;
ST_protocol
recv;
hummerbot
hbot(E1, M1, E2, M2, 13, A0);
void
setup() {
Serial.begin(9600);
hbot.init();
}
void
read_data
(void) {
unsigned char
avilable;
byte *p
=
readbuff
memset(p, 0, 32);
readlen
= 0;
while
(Serial.available() > 0) {
if
(
!avilable
avilable
}
if
(avilable) {
if
((
*p
avilable
readlen++;
//Serial.print(*p,HEX);
break;
}
//Serial.print(*p,HEX);
p++;
readlen++;
}
}
// Serial.print("\n");
}
void
loop() {
read_data();
;
&& Serial.peek() == START_CODE) {
= 1;
= Serial.read()) == END_CODE) {
= 0;
96

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Hummer-Bot-1.0 and is the answer not in the manual?

Questions and answers

Related Products for Keywish Hummer-Bot-1.0

Table of Contents