Shenzhen students made a big progress in the 4th Google App
Inventor Contest for High School and Middle School Students in China.
Organization Award:
SnakeAndHoneycomb: Built by Tan Yiwen, the winner of the Grand Prize in the middle school group, a 9th grade student of Shenzhen Longgang Keyuan School.
CodingAndDrawing: Built by Zhang Yuqi, the winner of the Second Prize in the high school group, a 10th grade student of the No.3 Senior High School of Shenzhen.
2017 MIT App Inventor Master Training was held
in Guangzhou from July 7 to July 9. The workshop was sponsored by Google China
and hosted by GEIC (Guangzhoug Education Information Center), SCUT (South China University of Technology). The workshop was organized by Liyue, the professor of SCUT. The most exciting thing is that Professor Harold Abelson attended our last day activity!
Hal visited GNIC and we gave him a mini party to celebrate his birthday. Several group teachers showed their works to Hal.
The main topic of the workshop is App Inventor and Robot. The robots are produced by Gao Weiguang (the IT teacher of Guangzhuo Baiyun Middle School) and his students. The shell of robots are printed by 3D printer.
Here are some fragments of teachers' works:
Here is the user interface of one of the teacher's works.
The splash screen use Canvas component, the robot is an imagesprite component. When you touch the robot, it will open the bluetooth AddressesAndNames list and you may choose the robot's bluetooth name to connect. Once the phone connects the robot successfully, a new screen will show.
You may click buttons to let the robot twinkle his eyes, dance, sing a happy birtyday song or speak out the temperature, humidity and distance, etc. You can ask some questions to the robot and he can reply to you, too. Cool, isn't it?
Again, 26th July, Happy 70th Birthday to professor Harold Abelson!
The app that built with App Inventor can turn LED strips lights on or off, adjust the light color temperature and brightness with your cell phone. It can do these by timer.
This works gained first prize in 2016 Guangdong Student Maker Contest!
Arthor: Huanglan, Liu jianke. They are all grade 9 students.
Mentors: He wei, Xiangqun Chen
User Interface - Components
Image 1: to show logo
lblSpace1~lblSpace6: to add spaces between components
listConnect: Listpicker component to a bluetooth address to connect
VerticalControl: VerticalArrangement component to put LED control panel. It includes several horizontal arrangements.
bthDisconnect: To disconnect the phone and LED Strips
lblNotifier: To show notifier
BluetoothClient1: BluetoothClient Component to connent the phone and LED strips
Clock1: in each interval time to check if there is a text to send to arduino board.
VerticalControl:
btnOn: Button component to turn the LED on or off
HorizontalTemp: To show color temperature
HorizontalSliderTemp:
SliderTemp: Slider component to change color temerature
HorizontalBrightness: To show color brightness
HorizontalSliderBright:
SliderBrightness: Slider component to change color brightnes
HorizontalSetTime:
TimePicker1: TimePicker component to pick time
SpinnerChoose: To select an event to do
HorizontalTimer:
btnStart: Button component to start a timer
btnCancell: Button component to cancell a timer
Blocks
Initialize variables
hour: hour of timer
minute: minute of timer
doWhat: text that sends to arduino board
status: 1: the light is on, 0: the light is off
ifSent: 1: the text has been sent, 0: the text hasn't been sent
Initialize screen: to initialize the background color of buttons
Before connecting, set listConnect.Elements to BluetoothClient1.AddressAndNames
After picking, if the cell phone is connected with arduino board, make the control panel to show, and hide listConnect.
When adjust temperature slider, gets the value of thumbPosition and calls BluetoothClient.SendText to send corresponding text. You should first round thumPosition.
If thumPosition is
1, then send text "A": The light is cold.
2, then send text "B": The light is warm.
3, then send text "C": The light is cold-warm.
When adjust brightness slider, gets the value of thumbPosition and calls BluetoothClient.SendText to send corresponding text. You should first round thumPosition.
If thumbPosition is
1, then send text "a", the brightness is 10% of
2, then send text "b"
3, then send text "c"
4, then send text "d"
5, then send text "e"
6, then send text "f"
7, then send text "g"
8, then send text "h"
9, then send text "i"
10, then send text "j"
When after choosing an event to do in time, to set value to doWhat variable.
If selection is
Light on, then set the variable doWhat to "A".
Light off, then set the variable doWhat to "B"
Warm light, then set the variable doWhat to "C"
Cold light, then set the variable doWhat to "D"
Cold_Warm light, then set the variable doWhat to "E"
10% brightness, then set the variable doWhat to "a"
20% brightness, then set the variable doWhat to "b"
30% brightness, then set the variable doWhat to "c"
40% brightness, then set the variable doWhat to "d"
50% brightness, then set the variable doWhat to "e"
60% brightness, then set the variable doWhat to "f"
70% brightness, then set the variable doWhat to "g"
80% brightness, then set the variable doWhat to "h"
90% brightness, then set the variable doWhat to "i"
100% brightness, then set the variable doWhat to "j"
When after picking time, set global.minute to TimePicker1.Minute, set global.hour to TimePicker1.Hour
When btnStart.Click, if time is valid, then set gloabal ifSent to 0, make btnStart and TimePicker1 disable, make btnCancell and Clock1 enable.
When btnCancell.Click, then set ifSent to 0, set Clock1.TimeEnabled to false.
When Clock1.Timer, if current time hits the setting time, the sends variable doWhat to arduino board, sets variable ifSent to 1, sets btnStart.Enabled and TimePicker1.Enabled to true, sets btnCancelled.Enable and Clock1.TimeEnabled to false.
When btnDisconnect.Click, set VerticalControl.Visible adn btnDisconnect.Visible to false, set listConnect.Visible to true, call BluetoothClient1.Disconnect.
Now we have finished all blocks. But there are so many if-then-else blocks and they do similar things!
we may optimize our blocks.
First, we add two variables:
timerItems: to store all 15 events: Light on, Light off, ... , 10% brightness, ... , 100% brightness.
sendText: to store all texts that send to arduino board: A~E, a~j
Define some procedures to call:
procedure: setBackgroundColor, to set some buttons BackgroundColor
procedure setTimerItemList: to set timerItems to a list that has 15 items.
procedure setSendTextList: to set sendText to a list that has 15 items.
Initialize screen:
When SpinnerChoose.AfterSelecting:
We just use one loop and one conditional blocks to do all judgement.
When btnOn.Click:
We use list items to substitute specific texts to update our blocks.
When SliderBrightness.PositionChanged:
We use a loop and a conditional block to judge all 10 conditions.
When SliderTemp.PositionChanged:
The items have index 3 to 5 in the list sendText are C, D and E.
So you see, the blocks are much more simple and logical.