Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Workshops On Designing Electronic Toys #10

Hirotaka Nakajima
June 10, 2014
150

Workshops On Designing Electronic Toys #10

Hirotaka Nakajima

June 10, 2014
Tweet

Transcript

  1. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Serial communication (Mac & Ubuntu) 6 • Unix

    screen program handles serial connection • Install Serial driver: http://www.ftdichip.com/Drivers/ VCP.htm • Open Terminal • (install the screen by “apt-get install screen”) • type “screen /dev/tty.usbserial-A7004C6X”
 underlined character differs by each gadget • to exit screen type “Ctrl A + k”
  2. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Final Project 8 • According to Syllabus:
 It

    is mandatory to present/demonstrate your masterpiece (electronic gadget) with written reports. • Electronic Gadget • Must have some sensor • Report • Written reports • Circuit Diagram
  3. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST LED3 11 • Send the data to PC

    through serial • http://web.sfc.keio.ac.jp/~takefuji/led3.tar • If you have done, draw diagram • AE-UM232R fritzing data
 http://www.densikit.com/home/fritzing
  4. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 12 int ledPin=8; int sensorPin = A0; int

    sensorValue = 0; void setup(){ pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop(){ sensorValue = analogRead(sensorPin); if(sensorValue>250){ digitalWrite(ledPin, 0); } else { digitalWrite(ledPin,1); } Serial.println(sensorValue,DEC); delay(1000); }
  5. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST LED3’ 13 • LED is turned on if

    the sensor value is > 250 • It works with specific LED but not works mine (for example) • Threshold should be based on the environment • Sensor LED data several times • Determine the threshold • Let’s change the program!