“I want to call it a Sister Kit, not a Starter Kit.”

Its name is now Bow (as in Bow-wow). And it’s a girl.

https://www.youtube.com/watch?v=bow-RU-31RA

Batteries are still charging. Meanwhile, I showed you the code and the instruction “Forward”. We’re learning how to “teach” the robot how to do things by sending it instructions. The first thing we’ll do is show it how to go forward. You said, “And then we’ll teach it to spin.” Good idea. Then I was thinking of teaching it how to use its “eyes” so it spins when you put your hand in front of it. Then maybe we’ll load the ultrasonic obstacle-avoidance program.

It’s alive! (Forward only) https://www.youtube.com/watch?v=Jy5Z61MLKCI

New trick (Turn left - but not enough power) https://www.youtube.com/watch?v=x1DMmhlCB2c

After adding more juice to motors: https://www.youtube.com/watch?v=O2pHKB4vFLc https://www.youtube.com/watch?v=p0Fye7oTqbY

Peekaboo mode: “Ultrasonic Car” demo program with Forward() replaced with Stop(): https://www.youtube.com/watch?v=uduxlZ9OkFo

Then we ran out of power :(

Update: Somehow I kept tinkering until 5am without batteries, but with the board attached to my computer. I couldn’t move the motors, but I could simulate it by printing to the SoftwareSerial. I added a “handbrake” mode so it pulls the handbrake if it’s stuck or if it gets bored. Then, to start it again, you first have to turn it so it’s no longer facing any obstacle. Then, give it the “Go” signal by waving in front of its eyes.

` /************************************************************************* * File Name : Makeblock Ultrasonic.ino * Author : Aaron * Updated : Aaron * Version : V1.0.0 * Date : 10/31/2014 * Description : Ultrasonic car with "Handbrake" and Hand Wave Go signal connect on the M1 and M2 port of baseshield, the Ultrasonic sensor connect on port 3. * License : CC-BY-SA 3.0 * Copyright (C) 2013 Maker Works Technology Co., Ltd. All right reserved. * http://www.makeblock.cc/ **************************************************************************/ #include #include #include #include MeDCMotor MotorL(M1); MeDCMotor MotorR(M2); MeUltrasonicSensor UltrasonicSensor(PORT_3); int moveSpeed = 190; int turnSpeed = 200; int stepPeriod = 150; int numStepsForward = 0; int maxStepsForward = 3000 / stepPeriod; int numTurnSteps = 0; int maxTurnSteps = 3000 / stepPeriod; boolean leftflag,rightflag; int OBS_PIN = 13; boolean debug = true; int handbrake = 2; // 2 = full stop, 1 = wait for "go" signal, 0 = no brakes long timeLastBlocked = 0; void setup() { randomSeed(analogRead(0)); if (debug) Serial.begin(9600); pinMode(OBS_PIN, OUTPUT); // "obstructed" LED Reset(); } void loop() { if (millis() % stepPeriod == 0) doUltrasonicCar(); } void doUltrasonicCar() { //buzzerOff(); // isStuck makes buzz. This clears all buzzes on next iter int distance = UltrasonicSensor.distanceCm(); boolean isBlocked = (distance > 2 && distance < 40); if (isBlocked) timeLastBlocked = millis(); else if (millis() - timeLastBlocked < 1000) isBlocked = true; boolean isStuck = (numTurnSteps > maxTurnSteps || numStepsForward > maxStepsForward); if (isBlocked) digitalWrite(OBS_PIN, HIGH); else digitalWrite(OBS_PIN, LOW); if (handbrake == 2 && !isBlocked) { // /unstuck, ready for go signal handbrake = 1; return; } else if (handbrake == 1 && isBlocked) { // "Go!" handbrake = 0; Reset(); return; } else if (handbrake == 0 && isStuck) { handbrake = 2; Stop(); //buzzerOn(); return; } if (handbrake > 0) return; if (isBlocked) { // avoid obstacle int randnum=random(300); if (randnum > 150 && !rightflag) TurnLeft(); else TurnRight(); } else { // ONWARD! Forward(); } } void Reset() { leftflag=false; rightflag=false; numStepsForward = 0; numTurnSteps = 0; if (debug) Serial.println("Reset"); } void Stop() { MotorL.stop(); MotorR.stop(); if (debug) Serial.println("Stop"); } void Forward() { numStepsForward++; numTurnSteps = 0; leftflag=false; rightflag=false; MotorL.run(moveSpeed); MotorR.run(moveSpeed); if (debug) Serial.println("Forward"); } void Backward() { numTurnSteps = 0; MotorL.run(-moveSpeed); MotorR.run(-moveSpeed); } void TurnLeft() { leftflag=true; numStepsForward = 0; numTurnSteps++; MotorL.run(-turnSpeed); MotorR.run(turnSpeed); if (debug) Serial.println("Left"); } void TurnRight() { rightflag=true; numStepsForward = 0; numTurnSteps++; MotorL.run(turnSpeed); MotorR.run(-turnSpeed); if (debug) Serial.println("Right"); } `