Learn, Make and Invent
  • Educational STEM Products
  • Early Primary
    • Bee Bot
    • Ozobot
    • Matatalab Coding Set
    • Neuron coding blocks
    • Osmo ios
    • Cubetto
    • Sphero Bolt
  • Primary
    • Codey Rocky AI Robot
      • Tutorials
        • Introduction
        • Get Started
        • Upload Mode
        • Emotion Blocks
        • IoT Blocks
        • Neuron Blocks
        • IR Remote
        • Use Python
      • Examples
      • Block Reference
        • Looks
        • Lighting
        • Speaker
        • Action
        • Sensing
        • Infrared
        • Events
        • Control
        • Operators
      • Python API Reference
        • Python API for Codey
        • Python API for Rocky
        • Python API for Third-Party Libraries
        • Python API for Neuron Extension Modules
      • FAQs
    • Edison
    • mBot
      • Introduction
      • Building mBot
      • Connect mBot
      • Preset Modes
    • Microbit
    • Merge Cube
    • Bare Conductive Board
    • Tello Edu
  • Secondary
    • Microbit Grove Inventor Kit
    • mBot Ranger
    • Arduino Science Kit
    • Arduino Starter Kit
    • Arduino Grove Starter Kit
    • CoDrone
  • Senior Secondary
    • CoDrone Pro
    • Arduino CTC Go
  • Digital Tech Kits
    • Digital Tech Kit for K-2
    • Digital Tech Kit for 3-5
    • Digital Tech Kit for 6-8
    • Digital Tech Kit for 9-10
  • Makerspace
    • Otto DIY
      • User guide
      • Assembly Instructions
        • Builder Kit
        • Builder Kit +
        • Builder Kit Humanoid
        • Builder Kit E
      • OTTO enclosures 3D and laser cut files
      • Code
    • Curcuitmess
      • Circuitmess Ringo
        • Inside the Box
        • Tools Needed
        • Soldering the parts
        • Assembling the parts
        • Set up your Ringo
  • Grove Ecosystem
    • Grove System
    • Grove Modules
      • Actuators
        • Atom Node
        • Grove 2 Coil Latching Relay
        • Grove Button
        • Grove Buzzer
        • Grove Dry Reed Relay
        • Grove EL Driver
        • Grove Haptic Motor
        • Grove I2C Motor Driver V1.2
        • Grove I2C Motor Driver V1.3
        • Grove I2C Motor Driver
        • Grove LED Matrix Driver v1.0
        • Grove Mini Fan
        • Grove Mini I2C Motor Driver v1.0
        • Grove MP3 v2.0
        • Grove Recorder v3.0
        • Grove Relay
        • Grove Serial MP3 Player
        • Grove Servo
        • Grove Solid State Relay
        • Grove Speaker
        • Grove Variable Color LED
        • Grove Vibration Motor
        • Grove Water Atomization
      • Display
        • Grove 4 Digit Display
        • Grove Circular LED
        • Grove LCD RGB Backlight
        • Grove LED Bar
        • Grove LED Socket Kit
        • Grove LED String Light
        • Grove LED Strip Driver
        • Grove OLED Display 0.96inch
        • Grove OLED Display 1.12inch
        • Grove Red LED
        • I2C LCD
      • Sensors
        • Grove 3 Axis Analog Accelerometer
        • Grove 3 Axis Compass V1.0
        • Grove 3 Axis Digital Accelerometer 1.5g
        • Grove 3 Axis Digital Accelerometer 16g
        • Grove 3 Axis Digital Accelerometer 400g
        • Grove 3 Axis Digital Gyro
        • Grove 6 Axis Accelerometer And Compass V2.0
        • Grove 6 Axis Accelerometer And Gyroscope
        • Grove 80cm Infrared Proximity Sensor
        • Grove Air Quality Sensor v1.3
        • Grove Alcohol Sensor
        • Grove Barometer Sensor BME280
        • Grove Barometer Sensor BMP180
        • Grove Barometer Sensor BMP280
        • Grove Barometer Sensor
        • Grove Barometer High Accuracy
        • Grove Chest Strap Heart Rate Sensor
        • Grove CO2 Sensor
        • Grove Collision Sensor
        • Grove Digital Infrared Temperature Sensor
        • Grove Digital Light Sensor
        • Grove Dust Sensor
        • Grove Ear clip Heart Rate Sensor
        • Grove Electricity Sensor
        • Grove Finger clip Heart Rate Sensor with shell
        • Grove Finger clip Heart Rate Sensor
        • Grove Fingerprint Sensor
        • Grove Gas Sensor O2
        • Grove Gas Sensor
        • Grove HCHO Sensor
        • Grove High Temperature Sensor
        • Grove IMU 10DOF v2.0
        • Grove Infrared Receiver
        • Grove Line Finder
        • Grove Temperature and Humidity Sensor Pro
        • Grove Temperature And Humidity Sensor
        • Grove Voltage Divider
        • Grove Water Sensor
        • Grove XBee Carrier
      • Communication
        • Grove High Precision RTC
        • Grove LoRa Radio
        • Grove NFC Tag
        • Grove NFC
        • Grove 125KHz RFID Reader
        • Grove 315MHz RF Kit
        • Grove 433MHz Simple RF Link Kit
        • Grove Bee Socket
        • Grove BLE v1
        • Grove BLE dual model v1.0
        • Grove DMX512
        • Grove GPS
        • Grove I2C ADC
        • Grove I2C FM Receiver
        • Grove Protoshield
        • Grove RJ45 Adapter
        • Grove Screw Terminal
        • Grove Serial Bluetooth v3.0
        • Grove Serial RF Pro
        • Grove UART Wifi
      • Others
        • Grove Base Booster Pack
        • Grove Base Cape for BeagleBone v2
        • Grove Base HAT
        • Grove Base Shield for NodeMCU V1.0
        • Grove Base Shield for Photon
        • Grove Breakout for LinkIt Smart 7688 Duo
        • Grove Cape for BeagleBone Series
        • Grove Indoor Environment Kit for Edison
        • Grove Inventor Kit for microbit
        • Grove IoT Developer Kit Microsoft Azure Edition
        • Grove IoT Starter Kits Powered by AWS
        • Grove Recorder
        • Grove Shield for Intel Joule
        • Grove Smart Plant Care Kit
        • Grove Speech Recognizer Kit for Arduino
        • Grove Starter Kit for BeagleBone Green
        • Grove Starter Kit for IoT based on Raspberry Pi
        • Grove Starter kit for LinkIt Smart7688 Duo
        • Grove Starter Kit v3
        • Grove AND
        • Grove Base Shield for IOIO OTG
        • Grove BlinkM
        • Grove DC Jack Power
        • Grove Differential Amplifier v1.0
        • Grove Differential Amplifier v1.2
        • Grove GSR Sensor
        • Grove I2C Hub
        • Grove Joint v2.0
        • Grove Mega Shield
        • Grove Mini Camera
        • Grove Mixer Pack V2
        • Grove MOSFET
        • Grove Node
        • Grove NOT
        • Grove NunChuck
        • Grove OR
        • Grove PS 2 Adapter
        • Grove Recorder v2.0
        • Grove Serial Bluetooth
        • Grove Serial LCD V1.0
        • Grove Single Axis Analog Gyro
        • Grove SPDT Relay 30A
        • Grove Starter Kit for LinkIt ONE
        • Grove Starter Kit for mbed
        • Grove Toy Kit
        • Grove Wrapper
        • GrovePi Plus
  • Arduino
    • Graphical coding with Grove sensors
    • Arduino Comparison Sheet
    • Tutorials
      • Setup Arduino Every board in Arduino IDE
      • Arduino Cloud
      • Installing Libraries
      • Motor, Servo for Arduino
      • Sensor for Arduino
    • Examples
      • Genuino 101
        • Prerequisites
        • Shock / Tap Detection
        • LED Control Over Bluetooth
        • Board Orientation Detection
        • Pedometer – Step Counting Over Bluetooth
        • Timer Switch
        • Appendices
          • Appendix A
          • Appendix B
  • micro:bit
    • Examples
      • Servo with micro:bit
  • Halocode
    • Introduction
    • Get Started
    • Upload Mode
    • Speech Recognition
    • User Cloud Message
    • Use Python with HaloCode
    • Code with Mu A Simple Python Editor
      • Examples
        • Basic Project
          • Color Mixer
          • Compare Strength
          • Connect Wi-Fi
          • Control Multiple HaloCodes via LAN
          • Energy Ring
          • Make a Smiling Face with the LED Ring
          • Make a Volume Detector
          • Press the Button to play LED Animation Meteor
          • Rainbow Button
        • Level Up
          • Control HaloCode's LEDs via Voice Command
          • Remote Control
          • Make HaloCode the Steering Wheel of the Car on Stage
          • HaloCode's Remote Control Deck
          • Emotion Detector
          • Deep Learning and Facial Recognition
          • Use Global Variable to Interact with Sprites
        • Workshop
          • A Kitten with Blinking Eyes and a Waving Tail
          • Pedometer
          • Smart Home
  • Troubleshooting
    • Matatalab
      • Matatalab Upgrade
        • Pre Upgrade Instructions - MatataBot
        • MatataBot Upgrade
        • Matata Tower Upgrade
        • Resources for Upgrade
      • Matatalab Pairing
Powered by GitBook
On this page
  • Codey Rocky Projects
  • 1. Change Codey's Emotions with Buttons
  • 2. Use Codey to Create LED Animations
  • 3. Turn Codey into a Musician
  • 4. Make Codey Blink Eyes
  • 5. Make Codey Rocky Identify Colors
  • 6. Make Codey Rocky Avoid Obstacles
  • 7. Use Codey to Make Sprites Play Instruments
  • 8. Design a Controller for Codey Rocky
  • 9. Make a Number Bomb Game
  • More Resources
  • Example Programs

Was this helpful?

  1. Primary
  2. Codey Rocky AI Robot

Examples

PreviousUse PythonNextBlock Reference

Last updated 5 years ago

Was this helpful?

Codey Rocky Projects

1. Change Codey's Emotions with Buttons

1) Drag a when button () is pressed block from the Events category to the Scripts area.

2) Drag a play sound () block from the Speaker category.

3) Drag a show image () block from the Looks category.

4) Click "Upload" to upload the program to Codey.

5) Press Button A to see how Codey looks!

2. Use Codey to Create LED Animations

1) Drag a when Codey is shaking block from the Events category to the Scripts area.

2) Drag a show image () for () secs block from the Looks category, and draw the following image. Reset the time to 0.3.

3) Add a show image () for () secs block from the Looks category, and draw the following image. Reset the time to 0.3.

4) Add another show image () for () secs block from the Looks category, and draw the following image. Reset the time to 0.3.

5) Add a Control block repeat () to wrap up the three show image () for () secs blocks. Reset the number to 6.

6) Drag a play sound () block from the Speaker category to add some sound effects. Set the sound as "jump".

7) Click "Upload" to upload the program to Codey.

8) Try shaking Codey to see the rabbit jumping!

3. Turn Codey into a Musician

1) Drag an Event block when button () is pressed to the Scripts area.

2) Add four play note () for () beats blocks from the Speaker category. Set the corresponding note as C4, E4, F4, and A5.

Volume Control Script

3) Drag a when Codey starts up block from the Events category.

4) Add a Speaker block set volume to ()% and a Sensing block gear potentiometer value, so that we can adjust the gear to change volume.

5) Add a Control block forever, so we are able to adjust the sound volume all the time.

6) Click "Upload" to upload the program to Codey.

7) Press Button A to see how Codey plays music!

4. Make Codey Blink Eyes

1) Drag an Event block when Codey starts up to the Scripts area.

2) Add a Looks block show image () for () secs. Add an Operators block pick random () to () to make Codey blink eyes randomly. Set the number as 2 and 5.

3) Add another Looks block show image () for () secs. Draw the following image, and set the time as 0.2.

4) Drag a Control block forever to wrap up the two show image () for () secs blocks, so Codey will keep blinking eyes.

5) Click "Upload" to upload the program to Codey.

6) Check Codey to see it blink eyes!

5. Make Codey Rocky Identify Colors

1) Drag an Event block when Codey starts up to the Scripts area.

2) Add a Control block if () then (), and a Sensing block the color detected is ()?.

3) Add a Lighting block RGB LED lights up () to make the LED lights up red when the color detected is red. Drag a play sound () block and change the sound to "score" to add some sound effects.

4) We want Codey Rocky to detect color blue. Right click to duplicate the blocks. Change the color to blue.

5) Add a Control block forever to create a loop.

6) Click "Upload" to upload the program to Codey.

7) Have a try!

Note: keep the IR sensor face-down.

6. Make Codey Rocky Avoid Obstacles

1) Drag an Event block when Codey starts up to the Scripts area.

2) Add a Looks block show image ().

3) Drag an Action block () at power ()%, a Control block wait until (), and a Sensing block obstacles ahead?. Keep all default values.

4) When Codey Rocky detects obstacles ahead, we want it to avoid them by moving backward and turning right, so we need to add three Action blocks: stop moving, move backward at power ()% for () secs, and turn right at power ()% for () secs.

5) Add a Control block forever to make Codey Rocky keep avoiding obstacles.

6) Click "Upload" to upload the program to Codey.

7) Check how Codey Rocky manages to stay away from obstacles.

Note: adjust the IR sensor to face-forward.

7. Use Codey to Make Sprites Play Instruments

This project combines stage programming with Codey.

Before we start, please toggle to disable Upload Mode.

1) Drag an Events block when button () is pressed.

2) When Button A is pressed, we want the sprite to receive the message. We need to add an Events block broadcast (). Click to create a new message "A".

3) Add a new sprite. Under "Sprites", click "+". From the pop-up Sprite Library window, choose "Drum" and click "OK".

4) Make sure "Drum" is selected. Drag an Event block when I receive (). Add a Sound block start sound () and keep the default "high tom".

5) Apply some animation effect to "Drum". Add a Looks block switch costume to (), and set the costume as "drum-b". Add a Control block wait () seconds, and change the value to 0.2. Add another Looks block switch costume to (), and set the costume as "drum-a".

6) Save your project. Press Button A to see what happens!

8. Design a Controller for Codey Rocky

This project combines stage programming with Codey.

Before we start, please toggle to disable Upload Mode.

Program Sprites

1) Under "Sprites", click "×" to delete the default sprite "Panda", and click "+" to add a new sprite. From the pop-up Sprites Library, choose "Arrow1" and click "OK".

2) Select "Arrow1". From the Events category, drag a when this sprite clicked block and a broadcast () block. Create a new message "Right".

3) Right click "Arrow1" to duplicate. The new sprite will automatically be named "Arrow2". Click "Costumes" to change the costume. Select costume 2. When done, click "×" finish costume setting. In the Scripts area, click to create a new message "Left".

4) Repeat step 3 to add another sprite "Arrow3" to broadcast message "Down".

5) Repeat step 3 to add another sprite "Arrow4" to broadcast message "Up".

6) Click to reposition the four arrows as the following image.

Program Codey

7) Choose "Codey" under "Devices". Drag an Events block when I receive () and set the message as "Left". Add an Action block turn left at power ()% for () secs, and keep the default value.

8) Drag an Events block when I receive () and set the message to "Right". Add an Action block turn right at power ()% for () secs, and keep the default value.

9) Drag an Events block when I receive () and set the message to "Up". Add an Action block move forward at power ()% for () secs, and keep the default value.

10) Drag an Events block when I receive () and set the message to "Down". Add an Action block move backward at power ()% for () secs, and keep the default value.

11) Save your project. Click the arrows on the stage and see how Codey Rocky moves!

9. Make a Number Bomb Game

1) Drag an Event block when Codey starts up to the Scripts area.

2) Choose Variables category and click "Make a Variable". Name the variable "Number" and click "OK".

3) Add a Variables block set Number to (), and keep default value.

4) Add a Looks block show () until scroll done and a Variables block Number.

5) Add an Events block when button () is pressed, and keep the default value. Add a Variables block change Number by () and also keep the default value.

6) Add a Speaker block play sound () to apply some sound effects to the game.

7) Click the following two blocks to duplicate and add them to the play sound () block.

8) Add a Control block if () then () to set how the game ends.

9) From the Operators category, drag a () > () block and a pick random () to () block. Set the number to 10 and 20. Then add a Variables block Number.

10) Add a Looks block show image () and draw the following image. Add a Speaker block play sound (), and set the sound to "explosion".

11) Click "Upload" to upload the program to Codey.

12) Have a try!

More Resources

Example Programs

You can find a variety of built-in example programs in mBlock 5. Go to the Project Management page to access those programs.