Difference between revisions of "Little Fortune Cat"

From Microduino Wiki
Jump to: navigation, search
(Relative Cases)
(Relative Cases)
 
Line 115: Line 115:
 
*'''[[Little Fortune Cat]]'''
 
*'''[[Little Fortune Cat]]'''
 
*'''[[Penalty Shootout]]'''
 
*'''[[Penalty Shootout]]'''
*'''[[Automatic Induction Door 1]]'''
+
*'''[[Smart Inductive Door 1]]'''
  
 
==FAQ==
 
==FAQ==
  
 
|}
 
|}

Latest revision as of 08:13, 22 March 2017

Overview

Anywhere money-cat.jpg

Let’s make a fortune cat whose eyes can light up and it can wave its hand to you when you approach to it.
Suitable kit: mCookie302


Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
mCookie-Hub 1 Sensor adapter plate
Servo 1 Servo
Servo Connector 1 Servo Connector
Line Finder 1 Detect objects
ColorLED 2 Color LED

Other Equipment

  • USB cable*1
  • Sensor cable*4
  • Sensor shell
  • Building blocks or other fixation structures
Anywhere money-cat-module.jpg

Module Setup

Setup

Anywhere money-cat-step.jpg
  • Assemble modules and sensors together:
    • Stick the red core module, battery base and the green hub together;
    • Connect the servo connector to pin 6/7 of Hub;
    • Connect the servo to pin 1 (the lower three pins) of servo connector;
    • Connect the Line Finder to pin A0 of Hub;
    • Connect the two ColorLEDs to pin 8/9 of Hub;
    • Plug one end of USB cable into the battery base, and connect the other end co computer;

Programming

Required Program Blocks


Program Thought

Detect the distance from the Line Finder of pin A0, if it is less than 800 (there is someone approaching), use every time program to change the brightness of ColorLEDs and the angle of the servo, implementing actions of waving hand and blinking eyes.

Mixly-ctrl-money-cat.jpg

Start to Program

1. Detect the distance of line finder A0
ColorLed prepare: connect two ColorLEDs to pin 8 Send the value of A0 line finder to the serial monitor. Wait for the value of A0 Line Finder to be less than 800 (someone is approaching).

Mixly-ctrl-money-cat-code.jpg

2. Wave hand and blink eyes.
Execute the internal program 30 times (the starting point of count is 60, and the ending point is 90).
。 Set the blue brightness level of the two ColorLEDs to (i-60)×4 (blue brightness level is 0-120)
。 Set the angle of the servo to the repeated time I (60-90 degrees).
。 Execute the internal program 30 times (the starting point of count is 90 and the ending point is 60).
。 Set the blue brightness level of the two ColorLEDs to (i-60)×4 (the blue brightness level is 120-0).
。 Set the angle of the servo to the repeated time I (90-60 degrees).

Mixly-ctrl-money-cat-code1.jpg



Test the result
After uploading, when you approach to the Line Finder near pin A0, the ColorLEDs will flash once, and the servo will spins once.

Anywhere money-cat.jpg



Q: When you touch the nose of the fortune cat, it can only wave hand once, how to modify the program to make it wave hand several times?
A: You can use “every time” program block, have you some ideas?

Execute “waving hand” and “blinking eyes” code twice.

Mixly-ctrl-money-cat-code2.jpg

Technical Specification

Relative Cases

FAQ