2017年8月1日 星期二

About BBC Micro: bit


The Micro Bit (also referred to as BBC Micro Bit, stylized as micro:bit) is an ARM-based embedded system designed by the BBC for use in computer education in the UK.

One of the main aims of the micro:bit is to “help a new generation get creative with technology and take advantage of the opportunities a career in science, technology, engineering and maths offers”.

The micro:bit, measuring just 4cm by 5cm, is a stripped down computer which children can use to code and create anything they set their minds to! It’s intended as a starter device to give children a basic introduction to physical computing and tinkering, so that they can move on to using more advanced devices such as an Arduino or Raspberry Pi.




Key features:

  • A display consisting of 25 red LEDs;
  • Two programmable buttons;
  • An on-board motion sensor or “accelerometer”;
  • A built-in compass or “magnetometer”;
  • Bluetooth Smart Technology;
  • Three input and output (I/O) rings.





Spec:


  • Nordic nRF51822 Multi-protocol Bluetooth® 4.0 low energy/2.4GHz RF SoC
    • 32-bit ARM Cortex M0 processor (16MHz)
    • 16kB RAM
    • 256kB Flash
    • Bluetooth Low Energy Master/Slave capable
  • Input/Output
    • 25 LED Matrix
    • Freescale MMA8652 3-axis Accelerometer
    • Freescale MAG3110 3-axis Magnetometer (e-compass)
    • Push Button x2
    • USB and Edge connector Serial I/O
    • 2/3 reconfigurable PWM outputs
    • 5 x Banana/Croc-clip connectors
    • Edge connector
    • 6 x Analog In
    • 6-17 GPIO (configuration dependent)
    • SPI
    • i2c

There are four official code editors in the BBC micro:bit web site

2017年7月30日 星期日

題目一: CSS + AJAX + JQuery + Node.js 應用


題目一: CSS + AJAX + JQuery + Node.js 應用


功能說明:


1. 瀏覽器利用AJAX 送出HTTP GET,URL路徑為/sensor/temp , 伺服端 (Node.js)會傳回Raspberry Pi CPU溫度.
2. 伺服端傳回格式為JSON , 如右格式: {“Sensor”: [{“Temp”:28}]}
3. 瀏覽器頁面必須及時更新溫度值, 並呈現如下內容. 溫度圖表設為20格,溫度範圍: 45~65 ℃
4. 當溫度 <= 55℃ 顯示綠色, >= 55 ℃ 黃色, >=60時℃顯示紅色





提示:
1.          讀取Raspberry Pi CPU溫度:  vcgencmd measure_temp
cat /sys/class/thermal/thermal_zone0/temp
2.          及時更新溫度的方式使用JQuery
3.          參考課程範例: WebFrontend/JQuery/industrial.js/demo.html  

4.          參考課程範例: Node_basic/example03/spwan.js  


完成結果:











2017年7月11日 星期二

Linux git push 使用



1) 先設定好 who you are.

Run

  git config --global user.email "xxxx@ittraining.com.tw"
  git config --global user.name "ittraining"


2) git commit: 顯示所有 Changes not staged for commit 的檔案

3) Staged for commit

git commit *  -m "............." 或
git commit <file list> -m ".........................."


4) git push : 將commit 的檔案全部上傳至git server







2017年7月6日 星期四

Raspberry Pi 3 使用紅外線

硬體準備


一個 IR 發射器及一個接收器 (使用Raspberry pi 3 Education Kit)

Demo




LIRC 軟體安裝及設定


Step 1: We need to install LIRC utility
pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install lirc

Step 2: 修改 /boot/config.txt

# Uncomment this to enable the lirc-rpi Module
dtoverlay=lirc-rpi
dtparam=gpio_in_pull=up   #將GPIO Input 均先設為Pull Up 

# Override the defaults for the lirc-rpi module

dtparam=gpio_in_pin=17   #IR接收
dtparam=gpio_out_pin=25 #IR發射


Step 3: 修改 /boot/config.txt

# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput"

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false

#Don't start irexec, even if a good config file seems to exist.
#START_IREXEC=false

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="UNCONFIGURED"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""

step 4:

Reboot