Here's some quick notes on what I discovered today on
The Zerynth Framework: programming IoT with Python
Good starting point well written on open-electronics.org
Here we learn of a new firmware that can be loaded on those microcontroller:
Here's some links for those microcontrollers, mostly based on ARM 32 bit.
- STM32 Nucleo family
 - Some kits and pricing at AliExpress from 18$
 - Arduino DUE
 - Kits on AliExpress from 13$
 - Particle.IO microcontrollers
 - Store from 19$
 - UDOO single board computer
 - 68$ at Digi-Key
 
Here's an example code for blinking 3 leds independently showing the power of Zerynth  multi-treading 
# Initialize the digital pins where the LEDs are connected as outputpinMode(D2,OUTPUT)pinMode(D3,OUTPUT)pinMode(D4,OUTPUT)# Define the ‘blink’ function to be used by the threads# delayON and delayOFF are optional parameters, used as default if not specified when you call the functiondef blink(pin,timeON=100,timeOFF=100):whileTrue:digitalWrite(pin,HIGH) # turn the LED ON by making the voltage HIGHsleep(timeON) # waitfortimeONdigitalWrite(pin,LOW) # turn the LED OFF by making the voltage LOWsleep(timeOFF) # waitfortimeOFF# Create three threads that execute instances of the ‘blink’ function.thread(blink,D2) # D2 is ONfor100 ms and OFFfor100 ms, thedefaultvalues of delayON an delayOFFthread(blink,D3,200) # D3 is ONfor200 ms and OFFfor100 ms, thedefaultvalue of delayOFFthread(blink,D4,500,200) # D4 is ONfor500 ms and OFFfor200 ms
To get you started with testing and development, they created the Zerynth shield
Which consist of many sensors and actuators 
This can be found here for around 56$
Here's an example of using this shield:
############################################################################################################# TOI Shield basics## Created by VIPER Team 2015 CC# Authors: L. Rizzello, G. Baldi, D. Mazzei############################################################################################################import streamsimport adcfrom drivers.toishield import toishieldstreams.serial()# toishield defines pin names in a board indipendent manner# let’s use them to read raw sensors valueswhile True:print(“ Microphone:”,adc.read(toishield.microphone_pin))print(“ Light:”,adc.read(toishield.light_pin))print(“Temperature:”,adc.read(toishield.temperature_pin))print(“ Touch:”,digitalRead(toishield.touch_pin))# aux pins are also accessible!print(“ AUX1:”,adc.read(toishield.aux1.ADC))print(“-”*40)sleep(500)# this scripts runs on every supported board, without a single change...cool isn’t it? <img src="http://www.open-electronics.org/wp-includes/images/smilies/simple-smile.png" alt=":)" class="wp-smiley" style="height: 1em; max-height: 1em;">Looks interesting, right!... now if you want to learn Python... there's a lot of resources:
- Youtube videos, like this 56 part Python 3.4 tutorial !
 - Coursera online courses
 - There's also online course like this neat Code Academy one!
 



Aucun commentaire:
Publier un commentaire