Keywish Hummer-Bot-2.0 Instruction Manual page 83

Table of Contents

Advertisement

void
setup() {
Serial.begin(9600);
irrecv.begin();
}
void
loop() {
byte
irKeyCode;
if
(irKeyCode
= irrecv.getCode())
{
Serial.println(irKeyCode,HEX);
if
(irKeyCode
analogWrite(INPUT1_PIN,
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN, 0);
analogWrite(INPUT4_PIN, val);
}
else if
(irKeyCode
val += 20;
if (val >= 240)
{
val = 255;
}
}
else if (irKeyCode == expedite2) {
val -= 20;
if (val <= 20)
{
val = 0;
}
}
else if (irKeyCode == stop) {
analogWrite(INPUT1_PIN, 0);
analogWrite(INPUT2_PIN, 0);
analogWrite(INPUT3_PIN, 0);
analogWrite(INPUT4_PIN, 0);
}
else if (irKeyCode == left) {
analogWrite(INPUT1_PIN, 0);
analogWrite(INPUT2_PIN, val); //the speed value of motorA is val
analogWrite(INPUT3_PIN, 0);
analogWrite(INPUT4_PIN, val); //the speed value of motorA is val
}
else if (irKeyCode == right) {
analogWrite(INPUT1_PIN, val);//the speed value of motorA is val
== advence) {
val);//the speed value of motorA is val
== expedite1) {
//the speed value of motorA is val
80

Advertisement

Table of Contents
loading

Related Products for Keywish Hummer-Bot-2.0

Table of Contents