2018年1月4日星期四

2017~2018年度学生小课题开题

自2017年秋季开学起到上周,三高高中部计算机社团主要学习了Python语言入门,包括Python语法基础、数据类型、算法等基本知识。社团成员已经有了编程的基础知识。
接下来,计算机社团将进行小课题的研究,目前有如下研究方向:
  • 基于Python编程的树莓派智能小车(市属中小学生探究性小课题)
  • 智能家居
  • App Inventor和物联网

经过半个学期的知识准备,昨天(2018.01.05日)下午的社团课正式启动研究项目。课上,学生进行了分组,每两人一组,选择各自感兴趣的内容进行研究。同时完成了第一次实验任务。

本节课任务:
  1. 展示整体的研究方向,明确任务
  2. 学生分组(两人一组)
  3. 学生头脑风暴,初步确定研究的内容及每次的课后成果

预期小组成果:
  1. 确定各小组成员
  2. 确定各小组的基本研究内容
  3. Arduino的基础
    1. Arduino板基本知识
    2. 高低电平初始化
    3. 代码的结构
  4. 实操任务
    1. 点亮LED
    2. 闪烁LED
  5. 资料查找任务
    1. 什么是LED灯?如何让LED灯点亮?
    2. 什么是高电平、低电平
    3. 数字口和模拟口的区别
    4. 代码的初始化及循环

分组后,每组同学领到了近期需要的实验器材,包括Arduino UNO控制板、传感器、面板板、杜邦线等,同时还给每组配发了笔记本,用于上课记笔记,记录实验过程、实验心得等。





 学生活动小视频:


学生小组任务提交地址:http://moocs.sz3gao.com/mod/assign/view.php?id=971

2017年12月31日星期日

2017 Google App Inventor contest

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年7月25日星期二

2017 MIT App Inventor Master Training in Guangzhou


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!



2017年4月3日星期一

App Inventor and Maker (2): Bluetooth Desk LED Light


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.

以下是中文代码

组件设置:

 

定义变量:








屏幕初始化:
























 将蓝牙列表赋值给列表选择框











选择完成后,如果蓝牙成功连接,显示垂直布局(控制面板)及断开按钮,隐藏列表选择框

















当点击开关按钮时,如果当前是开灯状态,将开关文本设置为“关灯”,否则将文本设置为“开灯”
























当改变色温时,发送相应文本: C为白光,D为黄白光,E 为黄光
























 当改变亮度时,获取当前亮度值:
1:亮度10%,2:亮度20%,... ,10:亮度100%









































 当选择完需要定时的任务后,发送相应字符: 15个任务对应15个字符,分别为A~E, a~j




















  

























当设置好定时的时间后,分别将小时和分钟的数值保存起来









当点击“定时”按钮后,开始计时





 当点击“取消”按钮时,取消当前定时的任务,关闭定时器













当计时器开始计时后, 如果到达计时点,则执行相应任务








当点击“断开”按钮时,隐藏LED灯控制面板,隐藏“断开”按钮,显示“连接”按钮,断开蓝牙连接。