KD0001 Kidsbits Multi-purpose Coding Box Kit
You can create a heap of fancy and cool things based this coding box kit. Like blinking LED, alarm navigator, smart fan, responder, ect.
We focus on puzzle programming, design and development of toy blocks! Combing the building block toy market and the maker education market effectively combined to create a favorite manufacturing brand for children, a mainstream open source programming platform.
My interface has V, G, S pins, V is for the positive pole, G is for the negative pole, and S pin for the digital port of yellow coding robot Each interface of the yellow coding robot is assembled with the positive pole, the negative pole and the digital port. Take my interface out with a wire and connect it to the digital interface D of the yellow coding robot.
Getting Started with Mixly
Introduction for Mixly
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.
Although there is an Ardublock graphical programming software launched by Arduino official, Ardublock is not perfect enough, and many common functions cannot be realized.
The figure below shows the functional comparison between Ardublock and Mixly.
It can be said that Mixly is the most versatile and smoothest Arduino graphical programming software, which can replace the Arduino programming tool IDE.
Design Concept and User Groups
Mixly is designed to be completely green. Currently Mixly supports win, ubuntu, mac. Windows users can download the Mixly package directly from the Internet, and unzip it to run on Windows XP and above (download link is attached below).
Mixly uses the Blockly graphical programming engine to replace complex text manipulation with graphical building blocks, providing a good foundation for beginners to get started quickly.
① Use the different color icons to represent different types of functional blocks, very convenient for users to classify.
② Provide default options in the composite function block to effectively reduce the number of user drags.
③ Integrate all the features of the software in the same interface.
④ Provide the reference tutorial and code examples.
It has versatile functions. Mixly can almost implement all the functions that Arduino IDE has. Support all official development boards of arduino.
The goal of the graphical programming system is definitely not to replace the original text programming method, but to better understand the programming principles and program thinking through graphical programming, and lay the foundation for future text programming.
It is also the design philosophy for Mixly. More continuous content has been added to the design of the software to protect the user's learning outcomes. To be specific, it includes the introduction of variable types, the consistency of text programming as much as possible in the design of the module, and the support of both graphical and text programming.
The most important design concept of Mixly is its ecological feature, which can distinguish it from other Arduino graphical programming.
It also allows users directly use Mixly's graphical programming function to generate common modules (such as LED digital display, buzzer broadcast, etc. Users are able to make this part of the module only using Mixly).
Both of the two kinds of modules mentioned above can be imported into the Mixly system through the "Import" function, thereby realizing the user's own value in the popularity of Mixly software.
User Groups From the above design concept, it can be seen that Mixly is suitable for primary and secondary school students to cultivate programming thinking. It is also available for quick programming when creating a work. Of course, it is good for those lovely friends who don't want to learn text programming, but want to do some small works with intelligent control.
Mixly Interface Functions
Some common functions:
Through this interface, you can complete the code compile、upload、save and manage. It support four remove methods: drag it left out code window, or drag to Recycle Bin, delete key, or right-click to delete block. It supports four languages: English、Español (Spanish)、中文简体(Chinese Simplified)、中文繁体(Chinese Traditional).
|1||Initialization (run only once)|
|2||End the program, means the program will stop running when use this block.|
|3||Delay function, click to select ms or us |
(pause the program for the amount of time (in milliseconds) specified as parameter. There are 1000 milliseconds in a second.)
|4||if_do function (first evaluate a value be true or false, if a value is true, then do some statement. |
You can click the blue gear icon to select the else if block or else block.)
|5||switch function. You can click the blue gear icon to select the case block or default block. (used to evaluate several programs then execute the corresponding function matched with program.)|
|6||Equal to for statement.|
|7||A while loop statement.|
|8||break function, used to exit from the containing loop.|
|9||millis() function, returns the system running time since the program started.
(The unit can be ms (milliseconds) or μs（microsecond)).
|10||Timer interrupt function, that is, set a trigger interrupt for the amount of time (in milliseconds) specified as parameter.|
|11||Timer interrupt start block|
|12||Timer interrupt stop block|
|2||Click to select the Arithmetic Operators: |
|3||Click to select the & (bitwise end); l (bitwise or); << (bitshift left); >> (bitshift right)|
|4||Click to select the sin; cos; tan; asin; acos; atan; ln; log10; e^; 10^; ++ (increment) ;|
|5||Click to select the Round; Ceil; Floor; abs; sq; sqrt |
Round: Returns the integer part a number using around.
|6||If select the max, returns the larger number; |
if select the min, returns the smaller number.
|7||Initialize the random seed|
|8||Return a random integer between the two specified limits, inclusive.|
|9||Constrain a number to be between the specified limits (inclusive). |
(generally used to constrain an analog value read from sensor)
|10||Map a number from the first interval to the second interval. |
(For instance, potentiometer-controlled servo, map the range of potentiometer (0, 1023) to the angle of servo (0, 180)).
|1||Declare and initialize a variable.|
|2||Define the data types|
For example: LED breath
You need an Arduino Uno and one LED module. Connect the control pin of LED module to Pin 3 of Uno board (or other pins with “~”，that is, those pins can output PWM signal). LED will gradually light then gradually dim, repeatedly.
You need an Arduino Uno board, an IR receiver module and an IR remote control.
Connect the signal pin of IR receiver to Digital pin 3 of Uno board, then upload the code and open the monitor. If send a signal to an IR receiver module using an IR remote control, you should see the monitor show the corresponding signal data.
For example: ultrasonic ranging
Connect the Trig pin of ultrasonic sensor to Digital 1 of Uno, Echo pin to D2, then upload the code and open the monitor, you should see the distance value, updating once per 100ms.
For example: serial communication
Separately connect the SDA (A4) and SCL (A5) of Arduino Uno to SDA and SCL pins of IIC LCD1602, then set the address of your LCD1602 screen, the LCD address we used here is 0x27. Then upload the code, LCD screen has two lines, you should see the line 1 print HELLO, and line 2 print 123456789.
For example: ultrasonic ranging
Below is an example code for line tracking car. We use three tracking modules (left to D6, middle to D7, right to D8). of course you need a tracking car to test it. First edit the forward, backward, turn left, turn right and stop into functions block. Then compile and upload the code below.
Download the Example Code: https://drive.google.com/open?id=1Fjd3SHHkg_-0IdB6GPX2uuTv3aRGMCSd
Download the Mixly software WIN: https://drive.google.com/open?id=1CtP1bvZB-o4M5SfvIOOwFz-488gWsFTJ
Download the Mixly software MAC: https://drive.google.com/open?id=1S0N_q73Dcyp85DjnbYm6MocZm3penOqU
We provide a heap of lessons to help starters to achieve different effects via coding robot. For instance, LED blink, responder, fire alarm and magic light and so on. These creative things stimulate children’s imagination, creation. Next, let’s enter the programming world!
Function 1: Blinking an LED
In this lesson, we will make red LED light by programming. Before coding, make sure you have connected well kidsbits coding box to PC with USB cable. (Based on Arduino Uno)
If connected, the indicator light on the kidsbits coding box will light, so it has current.
Open Mixly blocks platform to get started with coding.
First, click IN/OUT, drag the“DigitalWrite PIN# (0)Stat(HIGH)” block. This block is used to set the level HIGH or LOW of Digital pin. Select HIGH is to set the HIGH level. Select LOW is to set the LOW level. The HIGH level is the state of high voltage, generally recorded as 1.High voltage, high current, the LED is on. The LOW level is the state of low voltage, generally recorded as 0. Low voltage, low current, the LED is off.
For example, the LED on the coding box is marked with D7. So you should connect the red LED to Digital pin 7. Alright! turning on LED, we go to set the pin 7 to HIGH. Okay, we now select the Arduino Uno board and COM port; then click “Upload”. If upload success, the message“Upload success!”will appear on the status bar. The LED is turned on. Next, let’s achieve LED to blink.
Click IN/OUT, drag the “DigitalWrite PIN# (0)Stat(HIGH)” block.
This time we change the pin 0 into 7. Then right-click to copy the whole coding block. Change the High state into LOW. The code is complete; remember to Compile and Upload your code.
There should be a time interval when turning LED on and off. We need to insert a Delay block.
Go to Control block; drag the Delay block. 图 Here can change the delay time as we like. Try 1000ms. Now complete the code; we upload the code again. The red LED is blinking!
Function 2: Two LEDs On/Off
We’ve achieve to blink an LED.How about making two LEDs blink? To begin with, we will turn the 2 LEDs on then off one after another.
That is, red LED lights then goes out; followed by blue LED lights.
First, click IN/OUT, drag the“DigitalWrite PIN# (0)Stat(HIGH)” block and duplicate it three times. 图Firstly, see the labeled number separately for the red and the blue LED. Red LED-D7, the blue LED is labeled D8. Set the red LED pin 7 to HIGH, then LOW. So does the blue LED pin 8. 图Then insert delay block.图Do remember to upload your code. Check the final phenomenon.
Function 3: LEDs On/Off
Here we set the red LED pin and the blue LED pin to HIGH, both LEDs ON; set both LEDs pin to LOW, turn OFF. Thereby, we can turn all the LEDs on or off. Click IN/OUT, drag the“DigitalWrite PIN# (0)Stat(HIGH)”block and duplicate once. Set both pin 7 and 8 to HIGH, both LEDs turn ON. Then, we copy this piece of code and set to LOW, both LEDs turn OFF. 图 Don’t forget to insert delay block, then upload your code again. 图 Let’s combine all the code and upload. 图 We’ve achieve the effect of LED blink.
Project 2 LED Breath
Breathing light is like humans breath. Lights brightness slowly lighten then slowly dim. The kidsbits coding box has 12 digital pins, that is, D2~D13. (Based on Arduino Uno). All of them have the same general function, but some have other special function.
We also see some digital ports with“〜”which is called PWM(“Pulse-Width Modulation”) pins. The breathing LED light is connected to the Digital pin labeled“〜”. The general digital pins can only output HIGH or LOW level. However, PWM pins can steadily output the HIGH and LOW level, and can continuously change HIGH or LOW in a regular time period. The LED breathing effect is controlled by PWM. PWM can control voltage output in the range of 0~255. On the coding box, only the white LED marked with RGB LED，D3，D5，D6 is connected to PWM.
Click “IN/OUT”, drag the block “AnalogWrite PIN#（3）value（0）”图 Click the drop-down triangle icon to select digital pin; here we select pin 3 (digital pin 3). Fill in the value from 0 to 255. We try three different values, separately 50, 150, 255.
Connect kidsbits coding box to computer with a USB cable. Upload the different code to see the difference. 图 The greater the PWM output value, the brighter the LED is. Here we set different output value of RGB PWM pins to make RGB gradually brighten.
Click IN/OUT, drag the“AnalogWrite PIN#（3）value（0）”block. 图 Click the drop-down triangle icon to select digital pin 3. Set the PWM output value to 0. Then copy this code several times. Set the value to 0, 50, 100, 150, 200, 250. Insert delay block.Connect kidsbits coding box to computer with USB cable. Upload code and see RGB becoming brighter! 图 Then if we copy the code again. Change the value to 250, 200, 150, 100, 50, 0. Okay! Upload the complete code to see the final effect. The RGB is dimming. 图 Let’s make the two part code together: 图
Now we already made the RGB brighter and dimming gradually. At last, we upload the whole code to see the RGB breath.
But this whole code is so long, we can use this block“ count with (i) from (1) to (10) step (1)”to simplify. Go to Control block, use this block“ count with (i) from (1) to (10) step (1)”to simplify the total code. 图 So we first set the variable i from 0 to 250 step 50. Go to IN/OUT, drag the“AnalogWrite PIN#（3）value（0）”block into the “ count with (i) from (1) to (10) step (1)”block. Select pin 3 and drag a variables blockinto the block you just made. Finally, don’t forget to add a Delay block and set to1000ms. 图 At this moment, RGB LED gradually becomes brighter per 1000ms by a step of 50. The effect is same. Next Let’s set the Level value reducing from 250 to 0. Duplicate this code and change from 250 to 0. Change the step 50 into -50. 图 The dimming effect is created. Combine these two pieces of code to achieve the LED breath effect. 图
Project 3 Music Box
Except got LED blink and LED breath, we can also make our own music box via coding robot. All sounds are produced by vibration. The music box makes a sound by vibration, too. Some tones seem to be sharp, and some are lower. A low or sharp voice refers to the pitch of the sound. The sound is generated by the vibration of the sounding body. "high" pitch means very rapid oscillation; "low" pitch corresponds to slower oscillation. Just like the guitar. If you pluck the strings of different lengths and thicknesses. Some strings vibrate fast, producing high pitches. Some strings vibrate slowly, producing low pitches. Pluck the different strings to produce different tones. But if oscillating objects keep still, can we make it play different tones by programming? In coding robot, we’ll use buzzer to make coding robot sing a song. First, you need to connect buzzer to kidsbits coding box with USB cable. Buzzer is marker with D4, so connect to digital pin 4.
Go to“Actuator”, drag图 , change the pin 0 to digital pin 4.
Click triangle icon next to frequency; you’ll see a series of pitch names in English letters and Numbers.
You can choose different frequencies, that is, tone. We all know music requires tones as well as beats.Music in addition to "singing accurately", but also "rhythm-paired". The duration of each note, is the beat.We can use Delay block to set the beats.
1 beat, 1 second is 1000 milliseconds;
1/2 beat, 0.5 second is 500 milliseconds;
1/4 beat, 0.25 second is 250 milliseconds;
1/8 beat, 0.125 second is 125 milliseconds......
You can try to combine different tones (frequency) and beats (delay)
Go to“Actuator”, drag the“ Tone PIN#(0)frequency()”block.
图 Change the pin 0 into digital pin 4; select the frequency NOTE_C4 Then go to“Control”, drag the Delay block. Use this delay block to set the beats. 图 Next, go to“Actuator”, drag the“ noTone PIN#（0）”block. 图Change pin 0 into pin 4. Drag a Delay block again into the block you just made. You can get the code showed below: 图
Finally, we duplicate this piece of code third times. Change the Delay time for play into separately 500, 250,125 to set the beats. Well done! Upload the whole program to your kidsbits coding box. 图