KS0446 Keyestudio Frog Robot for Arduino Graphical Programming: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 1,119: Line 1,119:
<br>[[File:Pro10-图片24.png|600px|frameless|]]<br>
<br>[[File:Pro10-图片24.png|600px|frameless|]]<br>


Hold the button icon[[File:Pro10-图片25.png|100px|]], the phone Bluetooth sends a character “P” , Bluetooth module receives the character “P”, frog robot is dancing.<br>
Followed by go to the <span style="color:Teal"> “Text” </span>, drag out the block [[File:Pro9-图片12.png|50px|]] and drop it behind the <span style="color:green"> “case” </span>; change the “a” into “P”.<br>


<br>
<span style="color:blue"> Next, ready to write the code for frog robot dancing. </span>





Revision as of 11:33, 29 September 2019

Keyestudio Frog Robot for Arduino Graphical Programming


About the tutorial

What an amazing Otto Frog Robot is coming!
This kit provides a perfect opportunity to build your very first robot, and it makes the process of learning about robotics easy, interactive, and FUN!
The kit is based on the keyestudio nano ch340, compatible with both Arduino open-source platform and Mixly Blocks coding.
You can program your own robot to walk, dance and follow obstacle, easy to build and code. No prior tech experience required!
Through play and experimentation children can exercise computational thinking and put skills into practice that are necessary for problem solving.


Features

  • Voltage input: DC 7-12V
  • Ultrasonic module for measuring the front obstacle distance, forming obstacle avoiding system;
  • Pairing HM-10 Bluetooth module with mobile Bluetooth to navigate the frog robot;
  • Providing the mobile APP compatible with both Android and mac system;
  • The NANO shield extends 12 digital pins and 8 analog pins into 3pin header, easy to connect a couple of sensor modules for projects extension;
  • The NANO shield comes with an I2C communication pin, able to connect I2C communication module for experiment extension.


Ks0446图片2.png


Parts List

In this keyestudio frog robot kit package, you’ll receive all the components needed to build your own robot, easy to code and learn to play.

Ks0446图片3.png

Ks0446图片4.pngKs0446图片5.png



Get Started with Mixly and ARDUINO

1)Installing Arduino IDE

When program the UNO development board, you can download the Arduino integrated development environment from the link:


See more contents at:


Ks0436-9.png

The functions of each button on the Toolbar are listed below:
IDE.png

IDE 1.png Verify/Compile Check the code for errors
IDE 2.png Upload Upload the current Sketch to the Arduino
IDE 3.png New Create a new blank Sketch
IDE 4.png Open Show a list of Sketches
IDE 5.png Save Save the current Sketch
IDE 6.png Serial Monitor Display the serial data being sent from the Arduino


Or you can browse the KEYESTUDIO website at this link, https://www.keyestudio.com/ and then click on the WIKI Tutorial.
图片wiki.png



2)Introduction for Mixly Blocks

Mixly is a free open-source graphical Arduino programming software, based on Google’s Blockly graphical programming framework, and developed by Mixly Team@ BNU.
It is a free open-source graphical programming tool for creative electronic development; a complete support ecosystem for creative e-education; a stage for maker educators to realize their dreams.
More info please check the link to download the Mixly blocks software.

Before starting the robot projects, please click the link to get the basic understanding of Mixly software.
Ks0446图片8.png



3)Import Robot Library

For the robot kit, we have developed keyestudio frog robot library.
Don’t forget to import the keyestudio OTTO_Frog robot library to Mixly software before coding the robot projects.
Must import the robot library first, or else you can’t check all the test code.


Ks0446图片9.png

Unzip the OTTO_Frog library package, you can see the OTTO_Frog_Robot XML.document.
Ks0446图片10.png

Then import this document into Mixly library. Import custom library successfully!
Ks0446图片11.png

You are able to click “Manager” to manage all imported libraries.
Note: sometimes it may exists a conflict between libraries, so should keep only correct car library when using and delete other library.

Ks0446图片12.png



Hardware Projects

As you work your way through each project, you will learn to how to program the robot to move, dance, and follow obstacles.

Project 1: Keyestudio NANO CH340

Keyestudio Nano ch340


Introduction:
keyestudio Nano CH340 is a small, complete, and breadboard-friendly board based on the ATmega328P-AU. Compared with ARDUINO NANO, the USB-to-serial port chip used in keyestudio Nano is CH340G, so that the using method is the same except the driver installation file.
It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 8 analog inputs, a 16 MHz crystal oscillator, a mini USB port, an ICSP header and a reset button.
Note that ICSP (In-Circuit Serial Programming) header is used to program the firmware to ATMEGA328P-AU, but generally the chip has been preburned before leave the factory. So use it less.
The keyestudio Nano can be powered via the Mini-B USB connection, or female headers Vin/GND (DC 7-12V).


TECH SPECS:

Microcontroller ATmega328P-AU
Operating Voltage 5V
Input Voltage (recommended) DC7-12V
Digital I/O Pins 14 (D0-D13) (of which 6 provide PWM output)
PWM Digital I/O Pins 6 (D3, D5, D6, D9, D10, D11)
Analog Input Pins 8 (A0-A7)
DC Current per I/O Pin 40 mA
Flash Memory 32 KB of which 2 KB used by bootloader
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz
LED_BUILTIN D13


Element and Interfaces:
Here is an explanation of what every element and interface of the board does:
Ks0173 pinout.jpg


Specialized Functions of Some Pins:

  • Serial communication: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
  • PWM (Pulse-Width Modulation): D3, D5, D6, D9, D10, D11
  • External Interrupts: D2 (interrupt 0) and D3 (interrupt 1). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
  • SPI communication: D10 (SS), D11 (MOSI), D12 (MISO), D13 (SCK).
  • IIC communication: A4 (SDA); A5(SCL)


Project 2: keyestudio NANO Shield

Keyestudio NANO Shield (Black and Eco-friendly)


Introduction:
keyestudio Nano ch340 is a tiny control board based on Arduino platform, which is deeply popular.
However, if want to connect several sensor modules to keyestudio Nano ch340, and connect external power, we need to use breadboard and a bunch of jumper wires, which is pretty inconvenient.
We specially design this NANO shield, fully compatible with keyestudio Nano ch340.

TheNANO shield has brought out digital and analog pins of keyestudio Nano ch340 into 3PIN headers (GND, 5V, Signal) with pin pitch of 2.54mm.
The NANO shield also leads out frequently-used communication pins, such as serial port communication and I2C communication. It’s greatly easy to connect keyestudio Nano ch340 and other sensor modules.
It comes with a power indicator and a reset button as well.
For external power, the NANO shield comes with a PH2.0-2P connector (input DC7-12V); a Power_Switch for power control.
To supply power for other sensors, the NANO shield comes with a 3-way DC3.3V power output pin header with pin pitch of 2.54mm.
It comes with 4 fixing holes with a diameter of 3mm, so easy to mount on other devices.


Features:

  • 1.Extends 12 digital pins into 3pin header
  • 2.Extends 8 analog pins into 3pin header
  • 3.Comes with a serial communication pin header (for Bluetooth module)
  • 4.Comes with an I2C communication pin
  • 5.Comes with 3-way DC 3.3V power output pin
  • 6.Comes with a power indicator and a reset button
  • 7.Comes with an external power connector(PH2.0-2P)and a control button


thumb

Technical Parameters:

  • Voltage input: DC7-12V
  • Power connector: PH2.0-2P
  • Pin/Female header: 2.54mm
  • Fixing hole diameter: 3mm


Controller Compatible:


PINOUTS:

thumb


Use Method:
Simply stack the keyestudio Nano ch340 into the keystudio NANO shield. Supply the power with batteries via white connector.
thumb



Project 3: Adjusting Servo Angle

Servo


Introduction:
In the process of frog robot DIY, the frog robot has a 180° servomotor at each joint. We can control the servomotor at each joint to rotate at different angles, thus controlling the frog robot to run different actions.
In this course we focus on the principle and usage of the servomotor in the frog robot kit.
The servomotor is a position servo driver that can rotate between 0 and 180 degrees. If you want your robot assistant to help you get a book, the robot arm rotation angle is too big or too small, so that can't pick up the book. Only the angle is just right, it can complete the task of taking the book, so can accurately control the angle.

Servo motor is a position control rotary actuator. It mainly consists of housing, circuit board, core-less motor, gear and position sensor. 
Included with your servo motor you will find a variety of black mounts that connect to the shaft of your servo.
You may choose to attach any mount you wish for the circuit. It will serve as a visual aid, making it easier to see the servo spin.

Working principle:
The receiver or MCU outputs a signal to the servomotor. The motor has a built-in reference circuit that gives out reference signal, cycle of 20ms and width of 1.5ms. The motor compares the acquired DC bias voltage to the voltage of the potentiometer and outputs a voltage difference.

Servo motor comes with many specifications. But all of them have three connection wires, distinguished by brown, red, orange colors (different brand may have different color).
Brown one is for GND, red one for power positive, orange one for signal line.

thumb

The rotation angle of servo motor is controlled by regulating the duty cycle of PWM (Pulse-Width Modulation) signal. The standard cycle of PWM signal is 20ms (50Hz).
Theoretically, the width is distributed between 1ms-2ms, but in fact, it's between 0.5ms-2.5ms. The width corresponds the rotation angle from 0° to 180°.
But note that for different brand motor, the same signal may have different rotation angle. 

thumb

We can set the HIGH/LOW for corresponding pins in the Mixly blocks software, so as to adjust the servo angle;
furthermore, we specially create the robot library, so easy to control the servo angle with simplified code.


Connection Diagram:
Simply stack the keyestudio Nano ch340 into the keystudio NANO shield.
Connect the Servo pin to digital pin 4

thumb


Source Code:
Test the angle that servo motor moves between 0°and 180°
First of all, go to “Control” , drag and drop the command block “count with(i)from(1)to(10)step(1) do” thumb

And modify as from 0 to 180, step 1.
Then go to “OTTO_Frog” , drag and drop the block thumb.
This block library has set well the pulse width; can change the pin0 into any digital pins. Because the signal wire of servo motor is connected to digital pin 4, should change the pin0 to pin4.
Go to “Variables” , drag and drop the variable Pro3-图片3.png into angle 0 block. Set the delay time in any millisecond. We set to delay 200ms. The servo will slowly rotate from 0° to 180° for every 1° increase.

thumb

After that, we duplicate the above code string once, and set the value from 180 to 0, step set to -1. The rest keep same. Upload the complete code.

thumb



Test Result:
Upload the Code success, press down the Power_Switch, the servo motor will rotate back and forth from 0°to 180°.



Little Knowledge:
1.Pro3-图片5.png this piece of block is used to direct regulate the servo. connect the servo signal pin to D4; set the servo angle to a variableKs0446图片21.png, that is, this defined variable is applied to regulate the servo angle.
Because the servo angle is in the range of 0-180°, the range of variable Ks0446图片21.png should set from 0 to 180.
The delay period is in milliseconds, so if you want the servo turn more fast, change the value to 100.


Ks0446图片22.png
This block means variable i increases from 0 to 180, and each step increases 1.

Ks0446图片23.png
This block means variable i reduces from 180 to 0, and each step reduces 1.


Extension Practice:
1.Refer to the test code. Try to reset the servo pin and rotation speed
(Tips: set the delay time for servo angle ; or adjust to increase/reduce the step, which should be divisible by 180, like 2, 3, 5.)

Example Code 1:
Pro3-code2.png

Example Code 2:
Pro3-code3.png


Project 4: Ultrasonic Detecting Obstacles


Introduction:
The ultrasonic module will emit the ultrasonic waves after trigger signal. When the ultrasonic waves encounter the object and are reflected back, the module outputs an echo signal, so it can determine the distance of object from the time difference between trigger signal and echo signal.
We can use the ultrasonic sensor to detect whether there is an obstacle ahead. It is commonly used to measure the distance between the front obstacle and robot.
In the process of robot DIY, we can use the measured distance by ultrasonic sensor to build functional robots, such as automatic avoiding, following, etc.

In the experiment, we use the ultrasonic sensor to measure the distance between the robot and front obstacle.
The following picture is an ultrasonic module.
thumb

Specifications:

  • Operating voltage: DC 5V
  • Operating current: 15mA
  • Operating frequency: 40khz
  • Maximum detection range: 3-5m
  • Minimum detection range: 2cm
  • Induction Angle: less than 15 degrees
  • High accuracy: up to 3mm


Connection Diagram:
Connect the ultrasonic sensor to NANO shield, VCC pin to 5V(V), Trig pin to digital 6 (S), Echo pin to digital 7 (S), GND pin to GND(G); Then stack the NANO CH340 into the NANO shield.
thumb


Source Code:
Go to “Control” , drag out the “setup” block; Go to “SerialPort” , drag out the block “Serial baud rate(9600)” and “Serial printIn” , then drag the block “Serial baud rate(9600)” into the “setup” block.

Then go to “OTTO_Frog” , drag and drop the ultrasonic block Pro4-图片1.png into “Serial printIn” block Pro4-图片2.png.
And again go to “Control” , drag the delay block Pro4-图片3.png; set the delay time in 200ms.
Complete and upload the code.
Pro4-code.png


Test Result:
Upload the code success, press the Power_Switch on NANO shield.
Open the monitor and set the baud rate to 9600.
Move your hand or a large, flat object closer and farther away from the ultrasonic sensor. As the object approaches, the monitor will show the distance (unit:cm) being read from the sensor.

thumb


Little Knowledge:
1.In the code, we use thePro4-图片1.png to measure the distance between ultrasonic sensor and obstacle ahead, with a unit of cm.
2.Ks0446图片30.png means the baud rate is set to 9600;
Pro4-图片4.png: print the distance value on the newline of monitor.
If use thePro4-图片5.png , only print out the value but no line wrap.

3.What happens when you change the number in the delay(200):Ks0446图片32.png
This delay period is in milliseconds, so if you want the LED display as low, change the value, try 2000.



Extension Practice:
1.You can add new texts or distance unit on the monitor display.
thumb

2.Change the baud rate and delay time to see the result.
thumb


Project 5: Bluetooth Module

keyestudio HM-10 Bluetooth-4.0 V3

Description:
Bluetooth technology is a wireless standard technology that enables short-distance data exchange between fixed devices, mobile devices, and building personal area networks (using UHF radio waves in the ISM band of 2.4 to 2.485 GHz).
The Keyestudio HM-10 Bluetooth-4.0 V3 module is a master-slave machine. When use as the Host, it can send commands to the slave actively; when use as the Slave, it can only receive commands from the host.
The HM-10 Bluetooth module supports the Bluetooth 4.0 protocol, which not only supports Android mobile, but also supports iOS system.


Technical Details:

  • 1)Bluetooth protocol: Bluetooth Specification V4.0 BLE
  • 2)No byte limit in serial port Transceiving
  • 3)In open environment, realize 100m ultra-distance communication with iphone4s
  • 4)USB protocol: USB V2.0
  • 5)Working frequency: 2.4GHz ISM band
  • 6)Modulation method: GFSK(Gaussian Frequency Shift Keying)
  • 7)Transmission power: -23dbm, -6dbm, 0dbm, 6dbm, can be modified by AT command.
  • 8)Sensitivity: ≤-84dBm at 0.1% BER
  • 9)Transmission rate: Asynchronous: 6K bytes ; Synchronous: 6k Bytes
  • 10)Security feature: Authentication and encryption
  • 11)Supporting service: Central & Peripheral UUID FFE0, FFE1
  • 12)Power consumption: Auto sleep mode, stand by current 400uA~800uA, 8.5mA during transmission.
  • 13)Power supply: 5V DC
  • 14)Working temperature: –5 to +65 Centigrade


thumb


Pins Description:

thumb


Wiring Diagram:

thumb


Test Code:
When uploading the code, CANNOT connect the Bluetooth module; otherwise uploading fails!
You are supposed to upload the code to control board, then connect the Bluetooth module.


thumb


Result:
First should install the APP on the cellphone. Download the APP from the link: https://wiki.keyestudio.com/KS0455_keyestudio_HM-10_Bluetooth-4.0_V3_Compatible_with_HC-06_Pins


  • For Android APP:

We only provide Android APP.
APP installed well, you can see the icon thumb on your Android phone.
After wiring, upload the test code to UNO R3 board and then connect the Bluetooth module. Powered on, Bluetooth module’s built in LED flashes.
Open the Android APPthumb, click to scan device. As shown below.
thumb

Click Scan Device to search the Bluetooth.
thumb

Click the first device thumb to connect the Bluetooth.
Connected, built-in LED on the Bluetooth module is normally on. APP interface will show the state connected.
thumb

On the bar enter letter a, and click to send, APP will print out the character “keyestudio” and D13 indicator on the UNO R3 board will flash once.
Continue to send the letter a, APP prints out multiple “keyestudio” character and D13 indicator flashes.
thumb


  • For mac/iOS APP

You need to download the mac/iOS compatible APP in APP store.
First we enter the APP store, search hm10, and select the hm10 bluetooth serial lite.
thumb


Click to install the APP, as shown below.
thumb


APP installed well, a Bluetooth iconthumb will pop up on your phone. Click to enter the APP.

Upload the test code to control board successfully, then plug in the Bluetooth module.
Open the Bluetooth APP, click thumb to start searching and pairing the Bluetooth module. Click thumbto start connecting HM-10 Bluetooth module.
Connected, the built-in LED on the Bluetooth module will be from quick flash to normally on.

thumb

On the input bar enter a letter a, and click to send, APP will print out the character “keyestudio” and D13 indicator on the UNO R3 board will flash once.
Continue to send the letter a, APP prints out multiple “keyestudio” characters and D13 indicator flashes.
thumb



Robot Projects

Let’s get started to assembling the lovely frog robot to move, dance or even follow objects. Do operate the robot easily with Bluetooth APP!
Follow this easy and simple instruction of how to install and program your Otto Frog Robot!
Ks0446图片34.png


ROBOT ASSEMBLY

All the parts for building frog robot are included in the kit, assembling them is easy and typically takes around two hours!

Note:
Before install the frog robot, first need to regulate the 4 servo motors to 90°

Stack the Nano ch340 onto the Nano shield; connect 4 servo motors to digital pin5,4,3,2 separately.
Ks0446图片35.png


Test Code:
Upload the code below to turn the 4 servos to 90°
(Refer to project 3)
Open the Mixly blocks software, go to “OTTO_Frog”, drag out the block Pro3-图片2.pngand duplicate it three times.
Change the pin0 into pin2, pin3, pin4 and pin5 respectively. Angle set to 90; delay in 500ms.
Upload the test code to adjust well the servo angle.
Assembly servo code.png


1)Fix Feet

Pay more attention to: avoiding wrong assembly
The foot Acrylic plate with groove should place on the top. Another acrylic plate with two big holes should place at the bottom.



Install图片1.png


Install图片2.png


Install图片3.png


2)Fix Legs to Feet



Install图片4.png


Install图片5.png


Install图片6.png


Install图片7.png


Install图片8.png


3)Fix Head to Body



Install图片9.png


Install图片10.png


Install图片11.png


Install图片12-.png


Install图片13.png


Install图片14.png


4)Fix Servos to Body



Install图片15.png


Install图片16.png


Install图片17.png


5)Complete Frog



Install图片18.png


Install图片19.png


6)Hookup Guide

  • Connect the HC-SR04 ultrasonic sensor to keyestudio NANO shield using 4pin female to female jumper wires.

VCC pin to 5V(V), Trig pin to digital 6 (S), Echo pin to digital 7 (S), GND pin to GND(G);
(The ultrasonic sensor wiring can refer to the Project 4)

  • Connect 4 servo motors to digital pin5,4,3,2 separately.

(The 4 servos wiring can refer to the Project 3)

Ks0446图片60.png


  • The 4 servo motors’ wiring figure:
         ---------------
        |     O   O     |
        |---------------|
YR D3==> |             |   <== YL D2
         ---------------
            ||     ||
            ||     ||
RR D5==>  -----   ------   <== RL D4
         |-----   ------|


  • Plug in the Keyestudio HM-10 Bluetooth-4.0 module to pin header TX, RX, GND, 5V on the keyestudio NANO shield.


Ks0446图片61.png



Project 6: Walk

Ks0446图片65.png


Circuit Design:
After completing the robot assembly, you’ll see the 4 Servo motors on the robot are connected well to the keyestudio Nano ch340 shield.
We have introduced the knowledge of how to adjust the Servo angle.
In the circuit, we are going to make the 4 Servo motors switch different angles using keyestudio Nano ch340 shield, so as to operate the frog robot walk.

How it works?
When design the Otto frog robot, should first design the 4 Servo motors’ position and corresponding control pins.
Check the detailed instructions for servo control pins. As the figure shown below.


         ---------------
        |     O   O     |
        |---------------|
YR D3==> |             |   <== YL D2
         ---------------
            ||     ||
            ||     ||
RR D5==>  -----   ------   <== RL D4
         |-----   ------|


Hookup Guide:
Simply stack the keyestudio Nano ch340 into the keystudio NANO shield.
Connect the Servo pin to digital pin 2, 3, 4, 5 separately.
Ks0446图片66-.png


The most important step is to adjust the servo motors used in the robot via program. The adjustment here determines the quality of the frog walking and various postures:
First should adjust the servo of frog robot because there is an error when installing the servo.
Adjust the servo of the D2 pin first; adjust to a positive value, it will rotate to the right of the frog robot.
Go to “Control”, drag out the setup blockPro6-图片1.png; go to “OTTO_Frog” and find the block: Pro6-图片2.png
Then drag out this block into setup block:Pro6-图片3.png

The values filled in the leg and foot are used to set the corresponding rotation angle of servo installed in frog robot’s legs and feet.
For instance, set to adjust the left leg 10, other values no change; upload the code success, the left leg of robot will rotate 10° to the right.
Pro6-图片4.png

On the contrary, set to adjust the left leg -10, other values no change; upload the code success, the left leg of robot will rotate 10° to the left.
(Note: before upload the code, don’t plug in Bluetooth module. Otherwise, code upload fails. Should upload the code success, and then plug in Bluetooth module.)
Pro6-图片5.png


Adjust the servo of the D3 pin, as same as adjust the servo direction of the D2 pin, adjust the right leg.
Adjust the servo of the D4 pin, as same as adjust the servo direction of the D2 pin, adjust the left foot.
Adjust the servo of the D5 pin, as same as adjust the servo direction of the D2 pin, adjust the right foot.

You can change the corresponding value to adjust the direction of D3 pin servo, D4 pin servo and D5 pin servo.
Now you’ve learned how to set the rotation angle of D2, D3, D4 and D5 servo.
Because each of us might not install the frog robot in a very upright state. So it is necessary to adjust the frog robot to the best upright state.
Pro6-图片6.png



Coding:
Go to “Control”, drag out the setup blockPro6-图片1.png; and again go to “OTTO_Frog” and drag out the block Pro6-图片7.pnginto the setup block.
Take the robot we installed as an example, set to adjust the left leg 0, adjust the right leg 5, adjust the left foot -5, adjust the right foot -5, to initialize the frog robot in the best upright state.
Pro6-图片8.png

You can also set the value in the box behind the leg and foot to get the best upright state according to the actual situation of the frog robot you installed.
Set well the initialization state, if we want the frog robot to take 5 steps forward, 5 steps backward, stand and stop for 1 second, turn left for 5 steps, turn right for 5 steps, stand and stop for 1 second, how to write the program?

Go to “OTTO_Frog” to drag out the blockPro6-图片9.png , and change the step number to 5, speed at any value, here the default speed value as 2, so the frog robot will take 5 steps forward with a speed of 2.
Then we drag out the block Pro6-图片10.png and change the step number to 5, keep the same speed of 2.
And again go to drag and drop the blockPro6-图片11.png ; go to “Control”, drag out the delay blockPro6-图片12.png.
Pro6-图片13.png

Next go to “OTTO_Frog” , drag out the blockPro6-图片14.png ,Pro6-图片15.pngand Pro6-图片11.png, keep the same speed 2, change the step number to 5. And again add a delay time in 1000ms.
Pro6-图片17.png

Up till now, we’ve wrote well the program that the frog robot to take 5 steps forward, 5 steps backward, stand and stop for 1 second, turn left for 5 steps, turn right for 5 steps, stand and stop for 1 second.
Next upload this program code to see the result.
Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.

Ks0446图片67.png


Result:
Done uploading the code, press down the Power_Switch on Nano Shield.
The Otto frog robot is ready to walk 5 steps forward, back 5 steps, keep standing for 1 second, turn left for 5 steps, turn right for 5 steps, keep standing for 1 second, alternately and loop.
Ks0446图片68.png

Pro6-result.png


Project 7: Dance

Ks0446图片71.png


Circuit Design:
Based on the robot walks circuit, we are able to use the same electrical components and wiring method.
Just change the code to make the frog robot dance.


Hookup Guide:
Stack the Nano ch340 onto the Nano shield;
Connect 4 servo motors to digital pin5,4,3,2 separately.
Ks0446图片66-.png


Coding:
First, we adjust the optimal initial state of frog robot.
Go to “Control”, drag out the setup block; go to “OTTO_Frog” and drag out the blockPro6-图片7.png into the setup block.
Take the robot we installed as an example, set to adjust the left leg 0, adjust the right leg 5, adjust the left foot -5, adjust the right foot -5, to initialize the frog robot in the best upright state.
Pro6-图片8.png

And again go to “OTTO_Frog” , drag and drop the blockPro7-图片3.png, speed value can change randomly; here the default speed value as 2.
Go to “Control”, drag out the blockPro7-图片4.png and change as from 0 to 2 step 1. And drag out the blockPro7-图片5.pngfrom “OTTO_Frog” into the block just made.
You will get the complete blockPro7-图片6.pngand duplicate this block, drag out the block Pro7-图片7.png to replace the blockPro7-图片5.png.

So now you can get a small part of code string like below:
Pro7-图片9.png

Next drag out the blockPro7-图片10.png andPro7-图片11.png, change the step number to 3 and keep the speed value 2.
Followed by dragging and dropping the blockPro7-图片12.png, duplicate this block twice, keep the step number 1 and respectively change the speed value as 5, 1, 3.

Pro7-图片13.png

Go to “Control”, drag out the blockPro7-图片4.png and change as from 0 to 2 step 1. And drag out the blockPro7-图片15.pngfrom “OTTO_Frog” into the block just made. You will get the complete blockPro7-图片16.png;
And again drag and drop the blockPro7-图片17.png, change the step number to 5, speed value as 2; drag out the block Pro7-图片18.png beneath the block you just made.
Go to drag and drop the blockPro7-图片19.png and Pro7-图片20.png , change the both step number to 5, speed value still as 2. And drag out the blockPro7-图片21.png beneath the block you just made.
Continue to drag and drop the blockPro7-图片22.png, change the step number to 5, speed value still as 2.
Drag and drop the blockPro7-图片23.pngand Pro7-图片24.png one after another;
Pro7-图片25.png

Go to “Control”, drag out the blockPro7-图片4.pngand change as from 0 to 2 step 1. And drag out the blockPro7-图片27.pngfrom “OTTO_Frog” into the block just made. You will get the complete blockPro7-图片28.png.
And continue to drag and drop the blockPro7-图片29.png and Pro7-图片30.png.
Then duplicate the blockPro7-图片28.pngonce, and drag and drop the block Pro7-图片32.png.

Pro7-图片33.png

Until now, we’ve wrote well the program that make frog robot dance. Upload the complete code to check it.
Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.

Pro7-图片34.png


Result:
Done uploading the code, press down the Power_Switch on Nano Shield.
The Otto frog robot will dance. You will see unbelievable dancing movements.
Ks0446图片2.png


Project 8: Follow

Ks0446图片72.png


Circuit Design:
In the above sections, we have introduced how to use ultrasonic sensor to detect the front obstacle distance. We also operate the multiple style movements of frog robot.
In this circuit, we can first measure the distance of obstacle ahead with ultrasonic sensor, then navigate the robot’s movement style by distance value, so as to achieve the follow function.

The specific logic of ultrasonic follow is as shown below:
Pro8-图片1-1.png


Based on the circuit design, we can start making robot follow obstacles with ultrasonic sensor.
Follow the wiring diagram and test code below.


Hookup Guide:
Stack the Nano ch340 onto the Nano shield; connect ultrasonic sensor to Nano shield,
VCC pin to 5V(V), Trig pin to digital 6 (S), Echo pin to digital 7 (S), GND pin to GND(G).
Connect 4 servo motors to digital pin5,4,3,2 separately.
Ks0446图片74.png


Coding:
The four servomotors, an ultrasonic sensor and power supply have been connected well. Achieving the following function under the circumstance of ultrasonic measuring distance, we should do as follows:
Go to “Control” , drag out the setup block; go to “OTTO_Frog” and drag out the blockPro6-图片7.pnginto the setup block.
Take the robot we installed as an example, set to adjust the left leg 0, adjust the right leg 5, adjust the left foot -5, adjust the right foot -5, to initialize the frog robot in the best upright state.
Pro6-图片8.png

And next go to “Variables” , drag out the blockPro8-图片4.png. Drag out the blockPro8-图片5.pngfrom the “Math” into the block you just made, likePro8-图片6.png ; modify the “item” as “distance” and assign the value 0, so that set up a variablePro8-图片7.png.

A variable is like a box, and a new variable is like making a box; we can give the box a name, like we just called it “distance”.
The things placed inside the box can be changed, like we can place oranges, apples, pears, etc.
The function of the variable box in this program is to load the distance digit. With this box called “distance”, we can store the measured distance digit between ultrasonic sensor and front obstacle. So every time I mention distance, it refers to the distance value measured by the ultrasonic sensor at that time.

Go to “Variables” , drag out the blockPro8-图片8.png; and drag out the blockPro8-图片9.pngfrom “OTTO_Frog” into the block just made. You will get the complete blockPro8-图片10.png.

In order to observe the distance value measured by ultrasonic sensor on the serial monitor, we can add a serial port block. Go to the “SerialPort”, drag out the blockPro8-图片11.pngand Pro8-图片12.png ; remember to drag the serial baud rate(9600) block into setup block. And go to “Variables” , drag the blockPro8-图片13.pnginto the Serial printIn block.

Next judge the front obstacle distance measured by ultrasonic sensor, we could call the statement “if...do...else if...do” .
Go to “Control” , drag out the blockPro8-图片14.png, then click the blue gear icon, appear the edit box, drag the else if block into if blockPro8-图片15.png twice and then drag the else block beneath the else if block. Pro8-图片16.png So you can get the block Pro8-图片17.png.

Next, go to the “Logic”, drag out the “=” blockPro8-图片18.png and click the drop-down triangle to select the “>”; drag thePro8-图片13.png from the “Variables” into the first input box at the left side of “>”; drag thePro8-图片20.png from the “Math” into the second input box at the right side of “>” and remember to change the value 0 into 20. You will get the block Pro8-图片21.png and can set the value flexibly.
Then duplicate this block once, don’t forget to change the “>” into “<” and type the value 60. Pro8-图片22.png

Think back, we use a word “and” when describe the judgement condition.
Inside the “Logic”, there is also a Pro8-图片23.png block that return true if both inputs are true. We drag this “and” block behind the if block; then drag the blockPro8-图片21.png into the first input box of Pro8-图片23.pngblock and drag the blockPro8-图片22.png into the second input box of Pro8-图片23.pngblock.
So it represents the judgement condition “20 to 60 cm”.
Pro8-图片28.png

Next, go to “OTTO_Frog” , drag the block Pro8-图片29.png behind the do block, don’t change the step number and speed value.
Till now, we complete a part of code like below:
Pro8-图片30.png

In this way, when the measured distance between the ultrasonic sensor and front obstacles is greater than 20cm and smaller than 60cm, the frog robot will take one step at the speed of 2.


In the following, try to realize another two situations:
① The frog robot will keep standing when the measured distance between the ultrasonic sensor and front obstacles is greater than 10cm, and smaller than or equal to 20cm; or the measured distance is greater than or equal to 60cm.
② The frog robot will take one step back at the speed of 2 when the measured distance is smaller than or equal to 10cm.

We duplicate the blockPro8-图片31.pngonce behind the if block and drag it into the else if block; change the value as “distance>10”and“distance≤20”. Then go to “OTTO_Frog” , drag the blockPro8-图片32.png behind the do block.

Duplicate the blockPro8-图片33.pngonce, and drag it to the else if block; click the drop-down triangle to select the “≤”;
And again drag and drop the Pro8-图片34.png to the do block; else doPro8-图片32.png.


Now the complete code have wrote successfully.
Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.

Ks0446图片75.png


Result:
Done uploading the code, press down the Power_Switch on Nano Shield.
The Otto frog robot will move along with the front obstacle.
Ks0446图片76.png

Ks0446图片77.png


Project 9: Bluetooth Control

Ks0446图片82.png


Overview:
We are now ready to give the frog robot capability -- Bluetooth remote control!
For a smart robot, there should be a control terminal and a controlled terminal.
In the course, we use the mobile phone as the console (host), and the HM-10 Bluetooth module (slave) connected to the robot as the controlled terminal.
When using, we need to install an APP on the phone, and connect the HM-10 Bluetooth module, then we tap the buttons on the Bluetooth APP to navigate the multiple style movement of robot.


HM-10 Bluetooth

Bluetooth technology is a wireless standard technology that enables short-distance data exchange between fixed devices, mobile devices, and building personal area networks (using UHF radio waves in the ISM band of 2.4 to 2.485 GHz).
The robot kit is equipped with the HM-10 Bluetooth module, which is a master-slave machine. When use as the Host, it can send commands to the slave actively; when use as the Slave, it can only receive commands from the host.
The HM-10 Bluetooth module supports the Bluetooth 4.0 protocol, which not only supports Android mobile, but also supports iOS system.

thumb

In the experiment, we default use the HM-10 Bluetooth module as a Slave and the cellphone Bluetooth as a Host.
We install the Bluetooth APP on the mobile phone, connecting the Bluetooth module; finally use the Bluetooth APP to control the robot move, displaying the control character of each key on the serial monitor.

KS0193-图片88.png


Using Bluetooth APP

  • For Android system:

1.Click the Frog_Otto compression package to direct install the Frog_Otto APP; installed well, appear the icon below on your mobile phone:

thumb

Download the Frog_Otto package from the link below:
https://drive.google.com/open?id=1pymZOlVBVBWJ4s-1buKP3q5T1uM_b-tj


Or you can download the keyestudio Frog_Otto APP direct from the Google Play:
https://play.google.com/store/apps/details?id=com.keyestudio.frogotto
thumb


2.Tap the Frog_Otto icon to enter the Bluetooth APP. As shown below.
thumb


3.Done uploading the code to control board, connect the Bluetooth module, the LED on the Bluetooth module will flash.
Then tap the option CONNECT on the APP, searching the Bluetooth.
thumb


4.Click to connect the Bluetooth. HMSoft connected, Bluetooth LED will turn on normally.
thumb


  • For iOS system:

1.Open the APP store
thumb


2.Click to search the APP - Frog Otto
thumb


3.Tap to open the Frog Otto
thumb


4.Done uploading the code, connect the Bluetooth module, the LED on the Bluetooth module will flash.
To open Bluetooth, click the Connect on the APP upper left corner, searching and connecting Bluetooth.
thumb

thumb


5.Click to connect the Bluetooth. HMSoft connected, Bluetooth LED will turn on normally.
thumb



Bluetooth Test

Hookup Guide:
Stack the Nano ch340 on the Nano shield and plug in the Bluetooth module to pin TX, RX, GND, 5V.
thumb


Coding:
Downloaded the APP, and connected well the Bluetooth module and power supply, we need to write the program code to know what signal the Bluetooth module sent.
First drag out the blockPro9-图片1.png from the “OTTO_Frog”. And go to “SerialPort”, drag out the block Pro9-图片2.pnginto the Bluetooth block you just made.
Then go to “Variables” , drag out the blockPro9-图片3.png into the blockPro9-图片2.png.

Now you can upload the code.

Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.

thumb



Result:

  • 1)Upload the code to keyestudio nano ch340 success;
  • 2)Stack keyestudio nano ch340 onto Nano Shield;
  • 3)Connect Keyestudio nano ch340 to computer with a mini USB cable.
  • 4)Install well the Bluetooth APP;
  • 5)Powered on, press down the Power_Switch on Nano Shield. The indicator on Bluetooth module flashes. So you can open mobile Bluetooth APP to connect the Bluetooth module;
  • 6)Once Bluetooth connected, open the serial monitor and set the baud rate to 9600.
  • 7)Aimed at the Bluetooth module, tap the key on the Bluetooth APP, we can see the control character of each key. As the figure shown below.


thumb


Bluetooth Control Robot


Circuit Design:
We can combine the control character of each key on APP and extend to control the angle of 4 servos, so as to make the robot move.
The Bluetooth APP interface is shown below:
thumb

thumb

thumb


Based on the circuit design, we can start building Bluetooth remote control robot. Follow the wiring diagram and test code below.
Hookup Guide:
Stack the Nano ch340 on the Nano shield and plug in the Bluetooth module to pin TX, RX, GND, 5V. (RXD to TX, TXD to RX, GND to GND, VCC to 5V)
Connect 4 servo motors to digital pin5,4,3,2 separately.
thumb


Coding:
The four servomotors, a Bluetooth module and power supply have been connected well. We start writing a program code for Bluetooth controlled robot. We should do as follows:
Go to “Control” , drag out the setup block; go to “OTTO_Frog” and drag out the block Pro6-图片7.png into the setup block.
Take the robot we installed as an example, set to adjust the left leg 0, adjust the right leg 5, adjust the left foot -5, adjust the right foot -5, to initialize the frog robot in the best upright state.
Pro6-图片8.png

After setup, read the character signal of four direction buttons on Bluetooth APP with Bluetooth module.
First drag out the blockPro9-图片1.png from the “OTTO_Frog” . And go to “SerialPort”, drag out the block Pro9-图片2.pnginto the Bluetooth block you just made.
Then go to “Variables” , drag out the blockPro9-图片3.png into the blockPro9-图片2.png.

thumb


Tap and hold the button of any direction, Bluetooth module receives the corresponding signal, and the frog robot moves in the corresponding direction.
So here require to make “option” judgement; we will use the block Pro9-图片5.png from “Control” .
Drag out the blockPro9-图片5.png, then click the blue gear icon, appear the edit box Pro9-图片6.png, drag the Pro9-图片7.png block into Pro9-图片8.png block, turning into Pro9-图片9.png;

When the value of the "expression" behind the switch block is equal to the value of the "constant expression" behind a case block, the statement following this case is executed.
After executing the statement following a case, the process control is transferred to the next case to continue execution.
Since there are 4 direction buttons in the APP, press and hold the different direction buttons, the frog robot walks accordingly. After releasing all the buttons, the frog robot keeps standing. Here, 5 case statements are needed.

Click the blue gear icon, appear the edit boxPro9-图片6.png, drag the Pro9-图片7.png block into Pro9-图片8.png block four times, final get the statement below:
Pro9-图片10.png


Press and hold the different direction buttons, the frog robot walks accordingly.
Go to “Variables” , drag out the block Pro9-图片3.png and drop it behind the “switch” ;
Tap the front button iconKs0446图片102.png, frog robot will take one step forward at the speed of 2.
Go to the “Text” , drag out the block Pro9-图片12.pngand drop it behind the “case” .

Since press the front button, the phone Bluetooth will send a character “F” to the Bluetooth module on the frog robot. When the Bluetooth module receives the character “F”, it will change the “a” into “F”.
Go to the “OTTO_Frog” , drag the blockPro8-图片29.png into case and keep the same step number and speed.

Hold the back buttonKs0446图片103.png, the phone Bluetooth sends a character “B” , Bluetooth module receives the character “B”, frog robot will take one step backward at the speed of 2.
Go to the “Text” , drag out the blockPro9-图片12.png and drop it behind the “case” ; change the “a” into “B”.
Go to the “OTTO_Frog” , drag the blockPro9-图片16.png into case and keep the same step number and speed.

Next hold the left buttonKs0446图片104.png, the phone Bluetooth sends a character “L” , Bluetooth module receives the character “L”, frog robot will rotate to the left.
Hold the right buttonKs0446图片105.png, the phone Bluetooth sends a character “R” , Bluetooth module receives the character “R”, frog robot will rotate to the right.
Release all the buttons, the phone Bluetooth sends a character “S” , Bluetooth module receives the character “S”, frog robot will stop and keep standing.

It’s easy to write the code. Go to the “Text” , drag out the blockPro9-图片12.png and drop it behind the rest three “case” blocks respectively; change the “a” into “L”, “R”, “S” respectively.

Go to the “OTTO_Frog” , drag out the blockPro9-图片19.png, Pro9-图片20.png and Pro9-图片21.png into case ; and keep the same step number and speed.


Now the complete code have wrote well. Upload the code to remotely control the robot.
Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.
thumb


Result:

  • 1)Upload the code to keyestudio nano ch340 success;
  • 2)Stack keyestudio nano ch340 onto Nano Shield;
  • 3)Connect Keyestudio nano ch340 to computer with a mini USB cable.
  • 4)Install well the Bluetooth APP;
  • 5)Powered on, press down the Power_Switch on Nano Shield. The indicator on Bluetooth module flashes. So you can open mobile Bluetooth APP to connect the Bluetooth module;
  • 6)Once Bluetooth connected, aim at the Bluetooth module, tap the key on the Bluetooth APP to command the robot.

Tap the keyKs0446图片102.png, the frog robot will go forward; tapKs0446图片103.png, go back; tapKs0446图片104.png, turn left; tapKs0446图片105.png, turn right; release all the keys, robot stands still.
thumb



Project 10: Bluetooth Multiple Function


Circuit Design:
How to combine multiple functions for the frog robot we’ve learned? In this circuit, we use a complete code to program the smart car to switch different functions with Bluetooth APP, pretty simple and easy.
Ks0446图片78.png


Hookup Guide:
Stack the Nano ch340 onto the Nano shield; connect ultrasonic sensor to Nano shield,
VCC pin to 5V(V), Trig pin to digital 6 (S), Echo pin to digital 7 (S), GND pin to GND(G).
Connect 4 servo motors to digital pin5,4,3,2 separately.
Plug in the Bluetooth module to pin TX, RX, GND, 5V. (RXD to TX, TXD to RX, GND to GND, VCC to 5V)
Ks0446图片60.png


Coding:
The four servomotors, a Bluetooth module and power supply have been connected well. We start writing a multiple program for Bluetooth controlled robot. We should do as follows:
Go to “Control” , drag out the setup block; go to “OTTO_Frog” and drag out the block Pro6-图片7.png into the setup block.
Take the robot we installed as an example, set to adjust the left leg 0, adjust the right leg 5, adjust the left foot -5, adjust the right foot -5, to initialize the frog robot in the best upright state.
Pro6-图片8.png

After setup, read the character signal of four direction buttons on Bluetooth APP with Bluetooth module.
First drag out the blockPro9-图片1.png from the “OTTO_Frog” . And go to “SerialPort”, drag out the block Pro9-图片2.pnginto the Bluetooth block you just made.
Then go to “Variables” , drag out the blockPro9-图片3.png into the blockPro9-图片2.png.

thumb


Tap and hold the button of any direction, Bluetooth module receives the corresponding signal, and the frog robot moves in the corresponding direction.
So here require to make “option” judgement; we will use the block Pro9-图片5.png from “Control” .
Drag out the blockPro9-图片5.png, then click the blue gear icon, appear the edit box Pro9-图片6.png, drag the Pro9-图片7.png block into Pro9-图片8.png block, turning into Pro9-图片9.png;

When the value of the "expression" behind the switch block is equal to the value of the "constant expression" behind a case block, the statement following this case is executed.
After executing the statement following a case, the process control is transferred to the next case to continue execution.
Since there are 4 direction buttons in the APP, press and hold the different direction buttons, the frog robot walks accordingly. After releasing all the buttons, the frog robot keeps standing. Here, 5 case statements are needed.

Click the blue gear icon, appear the edit boxPro9-图片6.png, drag the Pro9-图片7.png block into Pro9-图片8.png block four times, final get the statement below:
Pro9-图片10.png


Press and hold the different direction buttons, the frog robot walks accordingly.
Go to “Variables” , drag out the block Pro9-图片3.png and drop it behind the “switch” ;
Tap the front button iconKs0446图片102.png, frog robot will take one step forward at the speed of 2.
Go to the “Text” , drag out the block Pro9-图片12.pngand drop it behind the “case” .

Since press the front button, the phone Bluetooth will send a character “F” to the Bluetooth module on the frog robot. When the Bluetooth module receives the character “F”, it will change the “a” into “F”.
Go to the “OTTO_Frog” , drag the blockPro8-图片29.png into case and keep the same step number and speed.

Hold the back buttonKs0446图片103.png, the phone Bluetooth sends a character “B” , Bluetooth module receives the character “B”, frog robot will take one step backward at the speed of 2.
Go to the “Text” , drag out the blockPro9-图片12.png and drop it behind the “case” ; change the “a” into “B”.
Go to the “OTTO_Frog” , drag the blockPro9-图片16.png into case and keep the same step number and speed.

Next hold the left buttonKs0446图片104.png, the phone Bluetooth sends a character “L” , Bluetooth module receives the character “L”, frog robot will rotate to the left.
Hold the right buttonKs0446图片105.png, the phone Bluetooth sends a character “R” , Bluetooth module receives the character “R”, frog robot will rotate to the right.
Release all the buttons, the phone Bluetooth sends a character “S” , Bluetooth module receives the character “S”, frog robot will stop and keep standing.

It’s easy to write the code. Go to the “Text” , drag out the blockPro9-图片12.png and drop it behind the rest three “case” blocks respectively; change the “a” into “L”, “R”, “S” respectively.

Go to the “OTTO_Frog” , drag out the blockPro9-图片19.png, Pro9-图片20.png and Pro9-图片21.png into case ; and keep the same step number and speed.


Up until now, we have wrote a small part of the program:

thumb

Apart from the four direction button icons on the APP, we can also use some other motion posture buttons on APP to control the frog robot.
Because there are 13 kinds of motion postures on the interface of APP, we continue to click the blue gear icon on the block Pro9-图片5.png , drag the Pro9-图片7.png block into Pro9-图片8.png block thirteen times.
Pro10图1.png


Hold the button icon Pro10图2.png, the phone Bluetooth sends a character “1” , Bluetooth module receives the character “1”, frog robot will moonwalk to the left.
Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case”; change the “a” into “1”.
Go to “OTTO_Frog”, drag the block Pro10图3.png beneath case‘1’ and keep the same step number and speed.

Hold the button icon Pro10图4.png, the phone Bluetooth sends a character “2” , Bluetooth module receives the character “2”, frog robot will moonwalk to the right. Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case”; change the “a” into “2”.
Go to “OTTO_Frog”, drag the block Pro10图5.png beneath case‘2’ and keep the same step number and speed.

Hold the button iconPro10图6.png, the phone Bluetooth sends a character “3” , Bluetooth module receives the character “3”, frog robot will galop to the right.
Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case”; change the “a” into “3”.
Go to the “OTTO_Frog”, drag the block Pro10图7.png beneath case‘3’.

Hold the button icon Pro10图8.png, the phone Bluetooth sends a character “4” , Bluetooth module receives the character “4”, frog robot will galop to the left.
Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case”; change the “a” into “4”.
Go to the “OTTO_Frog”, drag the block Pro10图9.png beneath case‘4’.

Hold the button icon Pro10图10.png, the phone Bluetooth sends a character “6” , Bluetooth module receives the character “6”, frog robot tilts to the left and then slowly returns. Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case”; change the “a” into “6”. Go to “OTTO_Frog”, drag the block Pro10图11.png beneath case‘6’.


Pro10图12.png

Hold the button iconPro10-图片11.png, the phone Bluetooth sends a character “7” , Bluetooth module receives the character “7”, frog robot will slide once.
Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “7”.
Go to “OTTO_Frog” , drag the block Pro10-图片12.png beneath case‘7’ and duplicate this block twice; keep step number as 1, separately change the speed value2 to 5, 1, 3.

Hold the button iconPro10-图片13.png, the phone Bluetooth sends a character “8” , Bluetooth module receives the character “8”, frog robot is rubbing.
Go to the “Text”, drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “8”.
Go to “OTTO_Frog” , drag the block Pro10-图片14.png beneath case‘8’.

Hold the button iconPro10-图片15.png, the phone Bluetooth sends a character “G” , Bluetooth module receives the character “G”, frog robot is flapping.
Go to the “Text” , drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “G”.
Go to “OTTO_Frog” , drag the block Pro10-图片16.png beneath case‘G’ . Keep the same speed value 4.


Pro10-图片17.png

Hold the button iconPro10-图片18.png, the phone Bluetooth sends a character “9” , Bluetooth module receives the character “9”, frog robot jumps.
Go to the “Text” , drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “9”.
Go to “OTTO_Frog” , drag the block Pro10-图片19.png beneath case‘9’ .

Hold the button iconPro10-图片20.png, the phone Bluetooth sends a character “H” , Bluetooth module receives the character “H”, frog robot swings.
Go to the “Text” , drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “H”.
Go to “OTTO_Frog” , drag the block Pro10-图片21.png beneath case‘H’. keep the same step number and speed.

Hold the button iconPro10-图片22.png, the phone Bluetooth sends a character “J” , Bluetooth module receives the character “J”, frog robot is slowly going up the feet then going down.
Go to the “Text” , drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “J”.
Go to “OTTO_Frog” , drag the block Pro10-图片23.png beneath case‘J’ . keep the same speed value 2.

Up until now, we have completed another small part of the program:
Pro10-图片24.png

Hold the button iconPro10-图片25.png, the phone Bluetooth sends a character “P” , Bluetooth module receives the character “P”, frog robot is dancing.
Followed by go to the “Text” , drag out the block Pro9-图片12.png and drop it behind the “case” ; change the “a” into “P”.


Next, ready to write the code for frog robot dancing.




Note: should upload the code success first, then plug in Bluetooth module. Otherwise, code upload fails.

Ks0446图片80.png


Result:

  • 1)Upload the code to keyestudio nano ch340 success;
  • 2)Stack keyestudio nano ch340 onto Nano Shield;
  • 3)Connect Keyestudio nano ch340 to computer with a mini USB cable.
  • 4)Install well the Bluetooth APP;
  • 5)Powered on, press down the Power_Switch on Nano Shield. The indicator on Bluetooth module flashes. So you can open mobile Bluetooth APP to connect the Bluetooth module;
  • 6)Once Bluetooth connected, aim at the Bluetooth module, tap the key on the Bluetooth APP. We can make the robot do any motions.


Ks0446图片81.png



Project Resources

  • Download the resource package:

https://1drv.ms/u/s!ArhgRvK6-RyJcfbRsZ0Tmotiu0g?e=eow9bk

  • Video:

http://video.keyestudio.com/ks0446/



About keyestudio

Located in Shenzhen, the Silicon Valley of China, KEYES DIY ROBOT co.,LTD is a thriving technology company dedicated to open-source hardware research and development, production and marketing.

Keyestudio is a best-selling brand owned by KEYES Corporation, our product lines range from Arduino boards, shields, sensor modules, Raspberry Pi, micro:bit extension boards and smart car to complete starter kits designed for customers of any level to learn Arduino knowledge.

All of our products comply with international quality standards and are greatly appreciated in a variety of different markets throughout the world.
Welcome check more contents from our official website:
http://www.keyestudio.com

Logo图片1.png


For more details of our products, you can check it from the links below.


Customer Service

As a continuous and fast growing technology company, we keep striving our best to offer you excellent products and quality service as to meet your expectation.
We look forward to hearing from you and any of your critical comment or suggestion would be much valuable to us.
You can reach out to us by simply drop a line at: Fennie@keyestudio.com
Thank you in advance.



Buy From