Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial

  • Loading branch information...
commit 560620fa36b4c0e4daf0c88c6f8c56f84f331e97 0 parents
@alinke authored
Showing with 18,564 additions and 0 deletions.
  1. +110 −0 FaceDetector.as
  2. +229 −0 Firmata2/FirmataForVersion4AndBelowSensorHubs/StandardFirmata.pde
  3. +229 −0 Firmata2/FirmataForVersion4AndBelowSensorHubs/StandardFirmata/StandardFirmata.pde
  4. +162 −0 Firmata2/FirmataForVersion5SensorHubs/Firmata.h
  5. +3 −0  Firmata2/FirmataForVersion5SensorHubs/IMPORTANT README.txt
  6. +229 −0 Firmata2/FirmataForVersion5SensorHubs/StandardFirmataForUno.pde
  7. +227 −0 Firmata2/StandardFirmata.pde
  8. BIN  Firmata2/StandardFirmata.zip
  9. +147 −0 MJPEG.as
  10. 0  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/.Clean
  11. +134 −0 as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Info.plist
  12. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/MacOS/Flash Player
  13. +1 −0  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/PkgInfo
  14. BIN  ...lue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/Flash Player.rsrc
  15. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/cs.lproj/Localized.rsrc
  16. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/de.lproj/Localized.rsrc
  17. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/document.icns
  18. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/en.lproj/Localized.rsrc
  19. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/es.lproj/Localized.rsrc
  20. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/fr.lproj/Localized.rsrc
  21. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/icon.icns
  22. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/it.lproj/Localized.rsrc
  23. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ja.lproj/Localized.rsrc
  24. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ko.lproj/Localized.rsrc
  25. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/mflv.icns
  26. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/movie.swf
  27. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/nl.lproj/Localized.rsrc
  28. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/pl.lproj/Localized.rsrc
  29. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/pt.lproj/Localized.rsrc
  30. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ru.lproj/Localized.rsrc
  31. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/sv.lproj/Localized.rsrc
  32. BIN  ...duino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/tr.lproj/Localized.rsrc
  33. BIN  ...no_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/zh_CN.lproj/Localized.rsrc
  34. BIN  ...no_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/zh_TW.lproj/Localized.rsrc
  35. BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.exe
  36. +176 −0 as3glue/arduino_as3glue_bundle_v1.6/readme.rtf
  37. BIN  as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy
  38. +57 −0 as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy.cfg
  39. BIN  as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy.exe
  40. BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.fla
  41. BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.pdf
  42. BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.swf
  43. BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_standalone_monitor.fla
  44. BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_standalone_monitor.swf
  45. +34 −0 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/ArduinoMonitor.as
  46. +25 −0 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/PinConfigObj.as
  47. +9 −0 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/PinMonitorObj.as
  48. +16 −0 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/WavePlot.as
  49. +4 −0 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/Arduino.as
  50. +65 −0 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/ArduinoWithServo.as
  51. +86 −0 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/events/ArduinoEvent.as
  52. +69 −0 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/events/ArduinoSysExEvent.as
  53. +128 −0 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/helpers/Log.as
  54. +112 −0 ascb/display/DraggableSprite.as
  55. +329 −0 ascb/drawing/Pen.as
  56. +31 −0 ascb/filters/ColorMatrixArrays.as
  57. +11 −0 ascb/filters/ConvolutionMatrixArrays.as
  58. +199 −0 ascb/play/Cards.as
  59. +124 −0 ascb/units/Converter.as
  60. +178 −0 ascb/units/Unit.as
  61. +223 −0 ascb/util/ArrayUtilities.as
  62. +262 −0 ascb/util/DateFormat.as
  63. +104 −0 ascb/util/DateUtilities.as
  64. +21 −0 ascb/util/DisplayObjectUtilities.as
  65. +154 −0 ascb/util/Locale.as
  66. +515 −0 ascb/util/NumberFormat.as
  67. +135 −0 ascb/util/NumberUtilities.as
  68. +159 −0 ascb/util/StringUtilities.as
  69. +43 −0 ascb/util/Tween.as
  70. +816 −0 aze/motion/EazeTween.as
  71. +46 −0 aze/motion/easing/Back.as
  72. +25 −0 aze/motion/easing/Cubic.as
  73. +50 −0 aze/motion/easing/Elastic.as
  74. +27 −0 aze/motion/easing/Expo.as
  75. +16 −0 aze/motion/easing/Linear.as
  76. +25 −0 aze/motion/easing/Quadratic.as
  77. +25 −0 aze/motion/easing/Quart.as
  78. +25 −0 aze/motion/easing/Quint.as
  79. +26 −0 aze/motion/eaze.as
  80. +49 −0 aze/motion/specials/EazeSpecial.as
  81. +131 −0 aze/motion/specials/PropertyBezier.as
  82. +335 −0 aze/motion/specials/PropertyColorMatrix.as
  83. +237 −0 aze/motion/specials/PropertyFilter.as
  84. +96 −0 aze/motion/specials/PropertyFrame.as
  85. +46 −0 aze/motion/specials/PropertyShortRotation.as
  86. +98 −0 aze/motion/specials/PropertyTint.as
  87. +53 −0 aze/motion/specials/PropertyVolume.as
  88. +4,355 −0 basic_config.as
  89. +50 −0 breath/breath/AnalogInput.pde
  90. +43 −0 breath/breath/Blink.pde
  91. +56 −0 breath/breath/Button.pde
  92. +75 −0 breath/breath/Calibration.pde
  93. +45 −0 breath/breath/Fading.pde
  94. +47 −0 breath/breath/ForLoopIteration.pde
  95. +55 −0 breath/breath/IfStatementConditional.pde
  96. +92 −0 breath/breath/StateChangeDetection.pde
  97. +88 −0 breath/breath/WhileStatementConditional.pde
  98. +102 −0 breath/breath/albreath.pde
  99. +48 −0 breath/breath/breath.pde
  100. BIN  breath/breath/breath2/applet/HardwareSerial.cpp.o
  101. BIN  breath/breath/breath2/applet/Print.cpp.o
  102. BIN  breath/breath/breath2/applet/WInterrupts.c.o
  103. BIN  breath/breath/breath2/applet/WMath.cpp.o
  104. BIN  breath/breath/breath2/applet/WaveHC/FatReader.cpp.o
  105. BIN  breath/breath/breath2/applet/WaveHC/SdReader.cpp.o
  106. BIN  breath/breath/breath2/applet/WaveHC/WaveHC.cpp.o
  107. BIN  breath/breath/breath2/applet/WaveHC/WaveUtil.cpp.o
  108. +422 −0 breath/breath/breath2/applet/breath2.cpp
  109. +1 −0  breath/breath/breath2/applet/breath2.cpp.eep
  110. BIN  breath/breath/breath2/applet/breath2.cpp.elf
  111. +811 −0 breath/breath/breath2/applet/breath2.cpp.hex
  112. BIN  breath/breath/breath2/applet/breath2.cpp.o
  113. BIN  breath/breath/breath2/applet/core.a
  114. BIN  breath/breath/breath2/applet/pins_arduino.c.o
  115. BIN  breath/breath/breath2/applet/wiring.c.o
  116. BIN  breath/breath/breath2/applet/wiring_analog.c.o
  117. BIN  breath/breath/breath2/applet/wiring_digital.c.o
  118. BIN  breath/breath/breath2/applet/wiring_pulse.c.o
  119. BIN  breath/breath/breath2/applet/wiring_shift.c.o
  120. +401 −0 breath/breath/breath2/breath2.pde
  121. BIN  breath/breath/breath2/wav/blow0.wav
  122. BIN  breath/breath/breath2/wav/blow1.wav
  123. BIN  breath/breath/breath2/wav/blow2.wav
  124. BIN  breath/breath/breath2/wav/blow3.wav
  125. BIN  breath/breath/breath2/wav/buzzed0.wav
  126. BIN  breath/breath/breath2/wav/buzzed1.wav
  127. BIN  breath/breath/breath2/wav/buzzed2.wav
  128. BIN  breath/breath/breath2/wav/buzzed3.wav
  129. BIN  breath/breath/breath2/wav/drunk0.wav
  130. BIN  breath/breath/breath2/wav/drunk1.wav
  131. BIN  breath/breath/breath2/wav/drunk2.wav
  132. BIN  breath/breath/breath2/wav/drunk3.wav
  133. BIN  breath/breath/breath2/wav/few0.wav
  134. BIN  breath/breath/breath2/wav/few1.wav
  135. BIN  breath/breath/breath2/wav/few2.wav
  136. BIN  breath/breath/breath2/wav/few3.wav
  137. BIN  breath/breath/breath2/wav/mode0.wav
  138. BIN  breath/breath/breath2/wav/mode1.wav
  139. BIN  breath/breath/breath2/wav/mode2.wav
  140. BIN  breath/breath/breath2/wav/mode3.wav
  141. BIN  breath/breath/breath2/wav/nothing0.wav
  142. BIN  breath/breath/breath2/wav/nothing1.wav
  143. BIN  breath/breath/breath2/wav/nothing2.wav
  144. BIN  breath/breath/breath2/wav/nothing3.wav
  145. BIN  breath/breath/breath2/wav/wait0.wav
  146. BIN  breath/breath/breath2/wav/wait1.wav
  147. BIN  breath/breath/breath2/wav/wait2.wav
  148. BIN  breath/breath/breath2/wav/wait3.wav
  149. BIN  breath/breath/breath2/wav2/blow0.wav
  150. BIN  breath/breath/breath2/wav2/blow1.wav
  151. BIN  breath/breath/breath2/wav2/blow2.wav
  152. BIN  breath/breath/breath2/wav2/blow3.wav
  153. BIN  breath/breath/breath2/wav2/buzzed0.wav
  154. BIN  breath/breath/breath2/wav2/buzzed1.wav
  155. BIN  breath/breath/breath2/wav2/buzzed2.wav
  156. BIN  breath/breath/breath2/wav2/buzzed3.wav
  157. BIN  breath/breath/breath2/wav2/drunk0.wav
  158. BIN  breath/breath/breath2/wav2/drunk1.wav
  159. BIN  breath/breath/breath2/wav2/drunk2.wav
  160. BIN  breath/breath/breath2/wav2/drunk3.wav
  161. BIN  breath/breath/breath2/wav2/few0.wav
  162. BIN  breath/breath/breath2/wav2/few1.wav
  163. BIN  breath/breath/breath2/wav2/few2.wav
  164. BIN  breath/breath/breath2/wav2/few3.wav
  165. BIN  breath/breath/breath2/wav2/mode0.wav
  166. BIN  breath/breath/breath2/wav2/mode1.wav
  167. BIN  breath/breath/breath2/wav2/mode2.wav
  168. BIN  breath/breath/breath2/wav2/mode3.wav
  169. BIN  breath/breath/breath2/wav2/nothing0.wav
  170. BIN  breath/breath/breath2/wav2/nothing1.wav
  171. BIN  breath/breath/breath2/wav2/nothing2.wav
  172. BIN  breath/breath/breath2/wav2/nothing3.wav
  173. BIN  breath/breath/breath2/wav2/wait0.wav
  174. BIN  breath/breath/breath2/wav2/wait1.wav
  175. BIN  breath/breath/breath2/wav2/wait2.wav
  176. BIN  breath/breath/breath2/wav2/wait3.wav
  177. BIN  breath/breath/breath2/wav3/blow0.wav
  178. BIN  breath/breath/breath2/wav3/blow1.wav
  179. BIN  breath/breath/breath2/wav3/blow2.wav
  180. BIN  breath/breath/breath2/wav3/blow3.wav
  181. BIN  breath/breath/breath2/wav3/buzzed0.wav
  182. BIN  breath/breath/breath2/wav3/buzzed1.wav
  183. BIN  breath/breath/breath2/wav3/buzzed2.wav
  184. BIN  breath/breath/breath2/wav3/buzzed3.wav
  185. BIN  breath/breath/breath2/wav3/drunk0.wav
  186. BIN  breath/breath/breath2/wav3/drunk1.wav
  187. BIN  breath/breath/breath2/wav3/drunk2.wav
  188. BIN  breath/breath/breath2/wav3/drunk3.wav
  189. BIN  breath/breath/breath2/wav3/few0.wav
  190. BIN  breath/breath/breath2/wav3/few1.wav
  191. BIN  breath/breath/breath2/wav3/few2.wav
  192. BIN  breath/breath/breath2/wav3/few3.wav
  193. BIN  breath/breath/breath2/wav3/mode0.wav
  194. BIN  breath/breath/breath2/wav3/mode1.wav
  195. BIN  breath/breath/breath2/wav3/mode2.wav
  196. BIN  breath/breath/breath2/wav3/mode3.wav
  197. BIN  breath/breath/breath2/wav3/nothing0.wav
  198. BIN  breath/breath/breath2/wav3/nothing1.wav
  199. BIN  breath/breath/breath2/wav3/nothing2.wav
  200. BIN  breath/breath/breath2/wav3/nothing3.wav
  201. BIN  breath/breath/breath2/wav3/wait0.wav
  202. BIN  breath/breath/breath2/wav3/wait1.wav
  203. BIN  breath/breath/breath2/wav3/wait2.wav
  204. BIN  breath/breath/breath2/wav3/wait3.wav
  205. +28 −0 breath/breath/breath2/wav_file_listing.txt
  206. BIN  breath/breath/breath3/applet/HardwareSerial.cpp.o
  207. BIN  breath/breath/breath3/applet/Print.cpp.o
  208. BIN  breath/breath/breath3/applet/WInterrupts.c.o
  209. BIN  breath/breath/breath3/applet/WMath.cpp.o
  210. BIN  breath/breath/breath3/applet/WaveHC/FatReader.cpp.o
  211. BIN  breath/breath/breath3/applet/WaveHC/SdReader.cpp.o
  212. BIN  breath/breath/breath3/applet/WaveHC/WaveHC.cpp.o
  213. BIN  breath/breath/breath3/applet/WaveHC/WaveUtil.cpp.o
  214. +422 −0 breath/breath/breath3/applet/breath3.cpp
  215. +1 −0  breath/breath/breath3/applet/breath3.cpp.eep
  216. BIN  breath/breath/breath3/applet/breath3.cpp.elf
  217. +812 −0 breath/breath/breath3/applet/breath3.cpp.hex
  218. BIN  breath/breath/breath3/applet/breath3.cpp.o
  219. BIN  breath/breath/breath3/applet/core.a
  220. BIN  breath/breath/breath3/applet/pins_arduino.c.o
  221. BIN  breath/breath/breath3/applet/wiring.c.o
  222. BIN  breath/breath/breath3/applet/wiring_analog.c.o
  223. BIN  breath/breath/breath3/applet/wiring_digital.c.o
  224. BIN  breath/breath/breath3/applet/wiring_pulse.c.o
  225. BIN  breath/breath/breath3/applet/wiring_shift.c.o
  226. +401 −0 breath/breath/breath3/breath3.pde
  227. BIN  breath/breath/breath3_nowav/applet/HardwareSerial.cpp.o
  228. BIN  breath/breath/breath3_nowav/applet/Print.cpp.o
  229. BIN  breath/breath/breath3_nowav/applet/WInterrupts.c.o
  230. BIN  breath/breath/breath3_nowav/applet/WMath.cpp.o
  231. BIN  breath/breath/breath3_nowav/applet/WaveHC/FatReader.cpp.o
  232. BIN  breath/breath/breath3_nowav/applet/WaveHC/SdReader.cpp.o
  233. BIN  breath/breath/breath3_nowav/applet/WaveHC/WaveHC.cpp.o
  234. BIN  breath/breath/breath3_nowav/applet/WaveHC/WaveUtil.cpp.o
  235. +431 −0 breath/breath/breath3_nowav/applet/breath3_nowav.cpp
  236. +1 −0  breath/breath/breath3_nowav/applet/breath3_nowav.cpp.eep
  237. BIN  breath/breath/breath3_nowav/applet/breath3_nowav.cpp.elf
  238. +696 −0 breath/breath/breath3_nowav/applet/breath3_nowav.cpp.hex
  239. BIN  breath/breath/breath3_nowav/applet/breath3_nowav.cpp.o
  240. BIN  breath/breath/breath3_nowav/applet/core.a
  241. BIN  breath/breath/breath3_nowav/applet/pins_arduino.c.o
  242. BIN  breath/breath/breath3_nowav/applet/wiring.c.o
  243. BIN  breath/breath/breath3_nowav/applet/wiring_analog.c.o
  244. BIN  breath/breath/breath3_nowav/applet/wiring_digital.c.o
  245. BIN  breath/breath/breath3_nowav/applet/wiring_pulse.c.o
  246. BIN  breath/breath/breath3_nowav/applet/wiring_shift.c.o
  247. +401 −0 breath/breath/breath3_nowav/breath3_nowav.pde
  248. BIN  breath/breath/breath4/applet/HardwareSerial.cpp.o
  249. BIN  breath/breath/breath4/applet/Print.cpp.o
  250. BIN  breath/breath/breath4/applet/WInterrupts.c.o
  251. BIN  breath/breath/breath4/applet/WMath.cpp.o
  252. BIN  breath/breath/breath4/applet/WaveHC/FatReader.cpp.o
  253. BIN  breath/breath/breath4/applet/WaveHC/SdReader.cpp.o
  254. BIN  breath/breath/breath4/applet/WaveHC/WaveHC.cpp.o
  255. BIN  breath/breath/breath4/applet/WaveHC/WaveUtil.cpp.o
  256. +430 −0 breath/breath/breath4/applet/breath4.cpp
  257. +1 −0  breath/breath/breath4/applet/breath4.cpp.eep
  258. BIN  breath/breath/breath4/applet/breath4.cpp.elf
  259. +812 −0 breath/breath/breath4/applet/breath4.cpp.hex
  260. BIN  breath/breath/breath4/applet/breath4.cpp.o
  261. BIN  breath/breath/breath4/applet/core.a
  262. BIN  breath/breath/breath4/applet/pins_arduino.c.o
  263. BIN  breath/breath/breath4/applet/wiring.c.o
  264. BIN  breath/breath/breath4/applet/wiring_analog.c.o
  265. BIN  breath/breath/breath4/applet/wiring_digital.c.o
  266. BIN  breath/breath/breath4/applet/wiring_pulse.c.o
  267. BIN  breath/breath/breath4/applet/wiring_shift.c.o
  268. +409 −0 breath/breath/breath4/breath4.pde
  269. +98 −0 breath/breath/language.txt
  270. +61 −0 breath/breath/switchCase.pde
  271. +3 −0  breath/readme.txt
  272. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/DO.WAV
  273. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/FA.WAV
  274. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/LA.WAV
  275. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/MI.WAV
  276. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/RE.WAV
  277. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/SO.WAV
  278. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/voice/TI.WAV
  279. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/DO.WAV
  280. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/DO_ALTO.WAV
  281. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/FA.WAV
  282. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/LA.WAV
  283. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/MI.WAV
  284. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/RE.WAV
  285. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/SO.WAV
  286. BIN  breath/waveshield/FilesForExamples/DO_RE_MI/xylophone/TI.WAV
  287. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF0.WAV
  288. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF1.WAV
  289. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF2.WAV
  290. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF3.WAV
  291. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF4.WAV
  292. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF5.WAV
  293. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF6.WAV
  294. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF7.WAV
  295. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF8.WAV
  296. BIN  breath/waveshield/FilesForExamples/DTMF/DTMF9.WAV
  297. BIN  breath/waveshield/FilesForExamples/DTMF/DTMFA.WAV
  298. BIN  breath/waveshield/FilesForExamples/DTMF/DTMFB.WAV
  299. BIN  breath/waveshield/FilesForExamples/DTMF/DTMFC.WAV
  300. BIN  breath/waveshield/FilesForExamples/DTMF/DTMFD.WAV
Sorry, we could not display the entire diff because too many files (2,164) changed.
110 FaceDetector.as
@@ -0,0 +1,110 @@
+package
+{
+ import flash.display.StageScaleMode;
+ import flash.display.StageAlign;
+ import flash.display.Sprite;
+ import flash.display.Loader;
+ import flash.display.Bitmap;
+ import flash.display.BitmapData;
+ import flash.display.Graphics;
+ import flash.events.Event;
+ import flash.geom.Rectangle;
+ import flash.net.URLRequest;
+ import flash.text.TextField;
+ import jp.maaash.ObjectDetection.ObjectDetector;
+ import jp.maaash.ObjectDetection.ObjectDetectorOptions;
+ import jp.maaash.ObjectDetection.ObjectDetectorEvent;
+
+ public class FaceDetector extends Sprite{
+ private var debug :Boolean = false;
+
+ private var detector :ObjectDetector;
+ private var options :ObjectDetectorOptions;
+ private var faceImage :Loader;
+ private var bmpTarget :Bitmap;
+
+ private var view :Sprite;
+ private var faceRectContainer :Sprite;
+ private var tf :TextField;
+
+ public function FaceDetector() {
+ initUI();
+ initDetector();
+ faceImage.load( new URLRequest("013.jpg") );
+ }
+
+ private function initUI():void{
+ stage.scaleMode = StageScaleMode.NO_SCALE;
+ stage.align = StageAlign.TOP_LEFT;
+
+ view = new Sprite;
+ addChild(view);
+
+ faceImage = new Loader;
+ faceImage.contentLoaderInfo.addEventListener( Event.COMPLETE, function(e :Event) :void {
+ startDetection();
+ });
+ view.addChild( faceImage );
+
+ faceRectContainer = new Sprite;
+ view.addChild( faceRectContainer );
+
+ tf = new TextField;
+ tf.x = 256;
+ tf.width = 600;
+ tf.height = 300;
+ tf.textColor = 0x000000;
+ tf.multiline = true;
+ view.addChild( tf );
+ }
+
+ private function initDetector():void{
+ detector = new ObjectDetector;
+ detector.options = getDetectorOptions();
+ detector.addEventListener(ObjectDetectorEvent.DETECTION_COMPLETE,function( e :ObjectDetectorEvent ):void{
+ logger("[ObjectDetectorEvent.COMPLETE]");
+ tf.appendText( "\ntime: "+(new Date)+" "+e.type );
+ detector.removeEventListener( ObjectDetectorEvent.DETECTION_COMPLETE, arguments.callee );
+
+ if( e.rects ){
+ var g :Graphics = faceRectContainer.graphics;
+ g.clear();
+ g.lineStyle( 2 ); // black 2pix
+ e.rects.forEach( function( r :Rectangle, idx :int, arr :Array ) :void {
+ g.drawRect( r.x, r.y, r.width, r.height );
+ });
+ }
+ });
+ var events :Array = [ ObjectDetectorEvent.DETECTION_START, ObjectDetectorEvent.HAARCASCADES_LOAD_COMPLETE, ObjectDetectorEvent.HAARCASCADES_LOADING ];
+ events.forEach( function(t :String, idx :int, arr :Array ) :void {
+ detector.addEventListener( t, function(e :ObjectDetectorEvent) :void {
+ tf.appendText( "\ntime: "+(new Date)+" "+e.type );
+ });
+ });
+ detector.loadHaarCascades( "face.zip" );
+ }
+
+ private function startDetection():void{
+ logger("[startDetection]");
+
+ bmpTarget = new Bitmap( new BitmapData( faceImage.width, faceImage.height, false ) )
+ bmpTarget.bitmapData.draw( faceImage );
+ detector.detect( bmpTarget );
+ }
+
+ private function getDetectorOptions() :ObjectDetectorOptions {
+ options = new ObjectDetectorOptions;
+ options.min_size = 50;
+ options.startx = ObjectDetectorOptions.INVALID_POS;
+ options.starty = ObjectDetectorOptions.INVALID_POS;
+ options.endx = ObjectDetectorOptions.INVALID_POS;
+ options.endy = ObjectDetectorOptions.INVALID_POS;
+ return options;
+ }
+
+ private function logger(... args):void{
+ if(!debug){ return; }
+ log(args);
+ }
+ }
+}
229 Firmata2/FirmataForVersion4AndBelowSensorHubs/StandardFirmata.pde
@@ -0,0 +1,229 @@
+/* DIY Magic Mirror Firmata Version
+
+ Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See file LICENSE.txt for further informations on licensing terms.
+ */
+
+/*
+ * This is an old version of StandardFirmata (v2.0). It is kept here because
+ * its the last version that works on an ATMEGA8 chip. Also, it can be used
+ * for host software that has not been updated to a newer version of the
+ * protocol. It also uses the old baud rate of 115200 rather than 57600.
+ */
+
+#include <EEPROM.h>
+#include <Firmata.h>
+
+/*==============================================================================
+ * GLOBAL VARIABLES
+ *============================================================================*/
+
+/* analog inputs */
+int analogInputsToReport = 0; // bitwise array to store pin reporting
+int analogPin = 0; // counter for reading analog pins
+
+/* digital pins */
+byte reportPINs[TOTAL_PORTS]; // PIN == input port
+byte previousPINs[TOTAL_PORTS]; // PIN == input port
+byte pinStatus[TOTAL_PINS]; // store pin status, default OUTPUT
+byte portStatus[TOTAL_PORTS];
+
+/* timer variables */
+unsigned long currentMillis; // store the current value from millis()
+unsigned long previousMillis; // for comparison with currentMillis
+
+
+/*==============================================================================
+ * FUNCTIONS
+ *============================================================================*/
+
+void outputPort(byte portNumber, byte portValue)
+{
+ portValue = portValue &~ portStatus[portNumber];
+ if(previousPINs[portNumber] != portValue) {
+ Firmata.sendDigitalPort(portNumber, portValue);
+ previousPINs[portNumber] = portValue;
+ Firmata.sendDigitalPort(portNumber, portValue);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * check all the active digital inputs for change of state, then add any events
+ * to the Serial output queue using Serial.print() */
+void checkDigitalInputs(void)
+{
+ byte i, tmp;
+ for(i=0; i < TOTAL_PORTS; i++) {
+ if(reportPINs[i]) {
+ switch(i) {
+ case 0: outputPort(0, PIND &~ B00000011); break; // ignore Rx/Tx 0/1
+ case 1: outputPort(1, PINB); break;
+ case 2: outputPort(2, PINC); break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets the pin mode to the correct state and sets the relevant bits in the
+ * two bit-arrays that track Digital I/O and PWM status
+ */
+void setPinModeCallback(byte pin, int mode) {
+ byte port = 0;
+ byte offset = 0;
+
+ if (pin < 8) {
+ port = 0;
+ offset = 0;
+ } else if (pin < 14) {
+ port = 1;
+ offset = 8;
+ } else if (pin < 22) {
+ port = 2;
+ offset = 14;
+ }
+
+ if(pin > 1) { // ignore RxTx (pins 0 and 1)
+ pinStatus[pin] = mode;
+ switch(mode) {
+ case INPUT:
+ pinMode(pin, INPUT);
+ portStatus[port] = portStatus[port] &~ (1 << (pin - offset));
+ break;
+ case OUTPUT:
+ digitalWrite(pin, LOW); // disable PWM
+ case PWM:
+ pinMode(pin, OUTPUT);
+ portStatus[port] = portStatus[port] | (1 << (pin - offset));
+ break;
+ //case ANALOG: // TODO figure this out
+ default:
+ Firmata.sendString("");
+ }
+ // TODO: save status to EEPROM here, if changed
+ }
+}
+
+void analogWriteCallback(byte pin, int value)
+{
+ setPinModeCallback(pin,PWM);
+ analogWrite(pin, value);
+}
+
+void digitalWriteCallback(byte port, int value)
+{
+ switch(port) {
+ case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1)
+ // 0xFF03 == B1111111100000011 0x03 == B00000011
+ PORTD = (value &~ 0xFF03) | (PORTD & 0x03);
+ break;
+ case 1: // pins 8-13 (14,15 are disabled for the crystal)
+ PORTB = (byte)value;
+ break;
+ case 2: // analog pins used as digital
+ PORTC = (byte)value;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets bits in a bit array (int) to toggle the reporting of the analogIns
+ */
+//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
+//}
+void reportAnalogCallback(byte pin, int value)
+{
+ if(value == 0) {
+ analogInputsToReport = analogInputsToReport &~ (1 << pin);
+ }
+ else { // everything but 0 enables reporting of that pin
+ analogInputsToReport = analogInputsToReport | (1 << pin);
+ }
+ // TODO: save status to EEPROM here, if changed
+}
+
+void reportDigitalCallback(byte port, int value)
+{
+ reportPINs[port] = (byte)value;
+ if(port == 2) // turn off analog reporting when used as digital
+ analogInputsToReport = 0;
+}
+
+/*==============================================================================
+ * SETUP()
+ *============================================================================*/
+void setup()
+{
+ byte i;
+
+ Firmata.setFirmwareVersion(5, 0);
+
+ Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
+ Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
+ Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
+ Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
+ Firmata.attach(SET_PIN_MODE, setPinModeCallback);
+
+ portStatus[0] = B00000011; // ignore Tx/RX pins
+ portStatus[1] = B11000000; // ignore 14/15 pins
+ portStatus[2] = B00000000;
+
+// for(i=0; i<TOTAL_PINS; ++i) { // TODO make this work with analogs
+ for(i=0; i<14; ++i) {
+ setPinModeCallback(i,OUTPUT);
+ }
+ // set all outputs to 0 to make sure internal pull-up resistors are off
+ PORTB = 0; // pins 8-15
+ PORTC = 0; // analog port
+ PORTD = 0; // pins 0-7
+
+ // TODO rethink the init, perhaps it should report analog on default
+ for(i=0; i<TOTAL_PORTS; ++i) {
+ reportPINs[i] = false;
+ }
+ // TODO: load state from EEPROM here
+
+ /* send digital inputs here, if enabled, to set the initial state on the
+ * host computer, since once in the loop(), this firmware will only send
+ * digital data on change. */
+ if(reportPINs[0]) outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
+ if(reportPINs[1]) outputPort(1, PINB);
+ if(reportPINs[2]) outputPort(2, PINC);
+
+ Firmata.begin(115200);
+}
+
+/*==============================================================================
+ * LOOP()
+ *============================================================================*/
+void loop()
+{
+/* DIGITALREAD - as fast as possible, check for changes and output them to the
+ * FTDI buffer using Serial.print() */
+ checkDigitalInputs();
+ currentMillis = millis();
+ if(currentMillis - previousMillis > 20) {
+ previousMillis += 20; // run this every 20ms
+ /* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
+ * all serialReads at once, i.e. empty the buffer */
+ while(Firmata.available())
+ Firmata.processInput();
+ /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
+ * 60 bytes. use a timer to sending an event character every 4 ms to
+ * trigger the buffer to dump. */
+
+ /* ANALOGREAD - right after the event character, do all of the
+ * analogReads(). These only need to be done every 4ms. */
+ for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
+ if( analogInputsToReport & (1 << analogPin) ) {
+ Firmata.sendAnalog(analogPin, analogRead(analogPin));
+ }
+ }
+ }
+}
229 Firmata2/FirmataForVersion4AndBelowSensorHubs/StandardFirmata/StandardFirmata.pde
@@ -0,0 +1,229 @@
+/* DIY Magic Mirror Firmata Version
+
+ Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See file LICENSE.txt for further informations on licensing terms.
+ */
+
+/*
+ * This is an old version of StandardFirmata (v2.0). It is kept here because
+ * its the last version that works on an ATMEGA8 chip. Also, it can be used
+ * for host software that has not been updated to a newer version of the
+ * protocol. It also uses the old baud rate of 115200 rather than 57600.
+ */
+
+#include <EEPROM.h>
+#include <Firmata.h>
+
+/*==============================================================================
+ * GLOBAL VARIABLES
+ *============================================================================*/
+
+/* analog inputs */
+int analogInputsToReport = 0; // bitwise array to store pin reporting
+int analogPin = 0; // counter for reading analog pins
+
+/* digital pins */
+byte reportPINs[TOTAL_PORTS]; // PIN == input port
+byte previousPINs[TOTAL_PORTS]; // PIN == input port
+byte pinStatus[TOTAL_PINS]; // store pin status, default OUTPUT
+byte portStatus[TOTAL_PORTS];
+
+/* timer variables */
+unsigned long currentMillis; // store the current value from millis()
+unsigned long previousMillis; // for comparison with currentMillis
+
+
+/*==============================================================================
+ * FUNCTIONS
+ *============================================================================*/
+
+void outputPort(byte portNumber, byte portValue)
+{
+ portValue = portValue &~ portStatus[portNumber];
+ if(previousPINs[portNumber] != portValue) {
+ Firmata.sendDigitalPort(portNumber, portValue);
+ previousPINs[portNumber] = portValue;
+ Firmata.sendDigitalPort(portNumber, portValue);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * check all the active digital inputs for change of state, then add any events
+ * to the Serial output queue using Serial.print() */
+void checkDigitalInputs(void)
+{
+ byte i, tmp;
+ for(i=0; i < TOTAL_PORTS; i++) {
+ if(reportPINs[i]) {
+ switch(i) {
+ case 0: outputPort(0, PIND &~ B00000011); break; // ignore Rx/Tx 0/1
+ case 1: outputPort(1, PINB); break;
+ case 2: outputPort(2, PINC); break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets the pin mode to the correct state and sets the relevant bits in the
+ * two bit-arrays that track Digital I/O and PWM status
+ */
+void setPinModeCallback(byte pin, int mode) {
+ byte port = 0;
+ byte offset = 0;
+
+ if (pin < 8) {
+ port = 0;
+ offset = 0;
+ } else if (pin < 14) {
+ port = 1;
+ offset = 8;
+ } else if (pin < 22) {
+ port = 2;
+ offset = 14;
+ }
+
+ if(pin > 1) { // ignore RxTx (pins 0 and 1)
+ pinStatus[pin] = mode;
+ switch(mode) {
+ case INPUT:
+ pinMode(pin, INPUT);
+ portStatus[port] = portStatus[port] &~ (1 << (pin - offset));
+ break;
+ case OUTPUT:
+ digitalWrite(pin, LOW); // disable PWM
+ case PWM:
+ pinMode(pin, OUTPUT);
+ portStatus[port] = portStatus[port] | (1 << (pin - offset));
+ break;
+ //case ANALOG: // TODO figure this out
+ default:
+ Firmata.sendString("");
+ }
+ // TODO: save status to EEPROM here, if changed
+ }
+}
+
+void analogWriteCallback(byte pin, int value)
+{
+ setPinModeCallback(pin,PWM);
+ analogWrite(pin, value);
+}
+
+void digitalWriteCallback(byte port, int value)
+{
+ switch(port) {
+ case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1)
+ // 0xFF03 == B1111111100000011 0x03 == B00000011
+ PORTD = (value &~ 0xFF03) | (PORTD & 0x03);
+ break;
+ case 1: // pins 8-13 (14,15 are disabled for the crystal)
+ PORTB = (byte)value;
+ break;
+ case 2: // analog pins used as digital
+ PORTC = (byte)value;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets bits in a bit array (int) to toggle the reporting of the analogIns
+ */
+//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
+//}
+void reportAnalogCallback(byte pin, int value)
+{
+ if(value == 0) {
+ analogInputsToReport = analogInputsToReport &~ (1 << pin);
+ }
+ else { // everything but 0 enables reporting of that pin
+ analogInputsToReport = analogInputsToReport | (1 << pin);
+ }
+ // TODO: save status to EEPROM here, if changed
+}
+
+void reportDigitalCallback(byte port, int value)
+{
+ reportPINs[port] = (byte)value;
+ if(port == 2) // turn off analog reporting when used as digital
+ analogInputsToReport = 0;
+}
+
+/*==============================================================================
+ * SETUP()
+ *============================================================================*/
+void setup()
+{
+ byte i;
+
+ Firmata.setFirmwareVersion(5, 0);
+
+ Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
+ Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
+ Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
+ Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
+ Firmata.attach(SET_PIN_MODE, setPinModeCallback);
+
+ portStatus[0] = B00000011; // ignore Tx/RX pins
+ portStatus[1] = B11000000; // ignore 14/15 pins
+ portStatus[2] = B00000000;
+
+// for(i=0; i<TOTAL_PINS; ++i) { // TODO make this work with analogs
+ for(i=0; i<14; ++i) {
+ setPinModeCallback(i,OUTPUT);
+ }
+ // set all outputs to 0 to make sure internal pull-up resistors are off
+ PORTB = 0; // pins 8-15
+ PORTC = 0; // analog port
+ PORTD = 0; // pins 0-7
+
+ // TODO rethink the init, perhaps it should report analog on default
+ for(i=0; i<TOTAL_PORTS; ++i) {
+ reportPINs[i] = false;
+ }
+ // TODO: load state from EEPROM here
+
+ /* send digital inputs here, if enabled, to set the initial state on the
+ * host computer, since once in the loop(), this firmware will only send
+ * digital data on change. */
+ if(reportPINs[0]) outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
+ if(reportPINs[1]) outputPort(1, PINB);
+ if(reportPINs[2]) outputPort(2, PINC);
+
+ Firmata.begin(115200);
+}
+
+/*==============================================================================
+ * LOOP()
+ *============================================================================*/
+void loop()
+{
+/* DIGITALREAD - as fast as possible, check for changes and output them to the
+ * FTDI buffer using Serial.print() */
+ checkDigitalInputs();
+ currentMillis = millis();
+ if(currentMillis - previousMillis > 20) {
+ previousMillis += 20; // run this every 20ms
+ /* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
+ * all serialReads at once, i.e. empty the buffer */
+ while(Firmata.available())
+ Firmata.processInput();
+ /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
+ * 60 bytes. use a timer to sending an event character every 4 ms to
+ * trigger the buffer to dump. */
+
+ /* ANALOGREAD - right after the event character, do all of the
+ * analogReads(). These only need to be done every 4ms. */
+ for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
+ if( analogInputsToReport & (1 << analogPin) ) {
+ Firmata.sendAnalog(analogPin, analogRead(analogPin));
+ }
+ }
+ }
+}
162 Firmata2/FirmataForVersion5SensorHubs/Firmata.h
@@ -0,0 +1,162 @@
+/* DIY Magic Mirror Version for boards with Arduino UNO
+ Firmata.h - Firmata library
+ Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See file LICENSE.txt for further informations on licensing terms.
+*/
+
+#ifndef Firmata_h
+#define Firmata_h
+
+#include <WProgram.h>
+#include <inttypes.h>
+
+
+/* Version numbers for the protocol. The protocol is still changing, so these
+ * version numbers are important. This number can be queried so that host
+ * software can test whether it will be compatible with the currently
+ * installed firmware. */
+#define FIRMATA_MAJOR_VERSION 5 // for non-compatible changes 2
+#define FIRMATA_MINOR_VERSION 0 // for backwards compatible changes 2
+
+#define MAX_DATA_BYTES 32 // max number of data bytes in non-Sysex messages
+
+// message command bytes (128-255/0x80-0xFF)
+#define DIGITAL_MESSAGE 0x90 // send data for a digital pin
+#define ANALOG_MESSAGE 0xE0 // send data for an analog pin (or PWM)
+#define REPORT_ANALOG 0xC0 // enable analog input by pin #
+#define REPORT_DIGITAL 0xD0 // enable digital input by port pair
+//
+#define SET_PIN_MODE 0xF4 // set a pin to INPUT/OUTPUT/PWM/etc
+//
+#define REPORT_VERSION 0xF9 // report protocol version
+#define SYSTEM_RESET 0xFF // reset from MIDI
+//
+#define START_SYSEX 0xF0 // start a MIDI Sysex message
+#define END_SYSEX 0xF7 // end a MIDI Sysex message
+
+// extended command set using sysex (0-127/0x00-0x7F)
+/* 0x00-0x0F reserved for user-defined commands */
+#define SERVO_CONFIG 0x70 // set max angle, minPulse, maxPulse, freq
+#define STRING_DATA 0x71 // a string message with 14-bits per char
+#define SHIFT_DATA 0x75 // a bitstream to/from a shift register
+#define I2C_REQUEST 0x76 // send an I2C read/write request
+#define I2C_REPLY 0x77 // a reply to an I2C read request
+#define I2C_CONFIG 0x78 // config I2C settings such as delay times and power pins
+#define EXTENDED_ANALOG 0x6F // analog write (PWM, Servo, etc) to any pin
+#define PIN_STATE_QUERY 0x6D // ask for a pin's current mode and value
+#define PIN_STATE_RESPONSE 0x6E // reply with pin's current mode and value
+#define CAPABILITY_QUERY 0x6B // ask for supported modes and resolution of all pins
+#define CAPABILITY_RESPONSE 0x6C // reply with supported modes and resolution
+#define ANALOG_MAPPING_QUERY 0x69 // ask for mapping of analog to pin numbers
+#define ANALOG_MAPPING_RESPONSE 0x6A // reply with mapping info
+#define REPORT_FIRMWARE 0x79 // report name and version of the firmware
+#define SAMPLING_INTERVAL 0x7A // set the poll rate of the main loop
+#define SYSEX_NON_REALTIME 0x7E // MIDI Reserved for non-realtime messages
+#define SYSEX_REALTIME 0x7F // MIDI Reserved for realtime messages
+// these are DEPRECATED to make the naming more consistent
+#define FIRMATA_STRING 0x71 // same as STRING_DATA
+#define SYSEX_I2C_REQUEST 0x76 // same as I2C_REQUEST
+#define SYSEX_I2C_REPLY 0x77 // same as I2C_REPLY
+#define SYSEX_SAMPLING_INTERVAL 0x7A // same as SAMPLING_INTERVAL
+
+// pin modes
+//#define INPUT 0x00 // defined in wiring.h
+//#define OUTPUT 0x01 // defined in wiring.h
+#define ANALOG 0x02 // analog pin in analogInput mode
+#define PWM 0x03 // digital pin in PWM output mode
+#define SERVO 0x04 // digital pin in Servo output mode
+#define SHIFT 0x05 // shiftIn/shiftOut mode
+#define I2C 0x06 // pin included in I2C setup
+#define TOTAL_PIN_MODES 7
+
+extern "C" {
+// callback function types
+ typedef void (*callbackFunction)(byte, int);
+ typedef void (*systemResetCallbackFunction)(void);
+ typedef void (*stringCallbackFunction)(char*);
+ typedef void (*sysexCallbackFunction)(byte command, byte argc, byte*argv);
+}
+
+
+// TODO make it a subclass of a generic Serial/Stream base class
+class FirmataClass
+{
+public:
+ FirmataClass();
+/* Arduino constructors */
+ void begin();
+ void begin(long);
+/* querying functions */
+ void printVersion(void);
+ void blinkVersion(void);
+ void printFirmwareVersion(void);
+ //void setFirmwareVersion(byte major, byte minor); // see macro below
+ void setFirmwareNameAndVersion(const char *name, byte major, byte minor);
+/* serial receive handling */
+ int available(void);
+ void processInput(void);
+/* serial send handling */
+ void sendAnalog(byte pin, int value);
+ void sendDigital(byte pin, int value); // TODO implement this
+ void sendDigitalPort(byte portNumber, int portData);
+ void sendString(const char* string);
+ void sendString(byte command, const char* string);
+ void sendSysex(byte command, byte bytec, byte* bytev);
+/* attach & detach callback functions to messages */
+ void attach(byte command, callbackFunction newFunction);
+ void attach(byte command, systemResetCallbackFunction newFunction);
+ void attach(byte command, stringCallbackFunction newFunction);
+ void attach(byte command, sysexCallbackFunction newFunction);
+ void detach(byte command);
+
+private:
+/* firmware name and version */
+ byte firmwareVersionCount;
+ byte *firmwareVersionVector;
+/* input message handling */
+ byte waitForData; // this flag says the next serial input will be data
+ byte executeMultiByteCommand; // execute this after getting multi-byte data
+ byte multiByteChannel; // channel data for multiByteCommands
+ byte storedInputData[MAX_DATA_BYTES]; // multi-byte data
+/* sysex */
+ boolean parsingSysex;
+ int sysexBytesRead;
+/* callback functions */
+ callbackFunction currentAnalogCallback;
+ callbackFunction currentDigitalCallback;
+ callbackFunction currentReportAnalogCallback;
+ callbackFunction currentReportDigitalCallback;
+ callbackFunction currentPinModeCallback;
+ systemResetCallbackFunction currentSystemResetCallback;
+ stringCallbackFunction currentStringCallback;
+ sysexCallbackFunction currentSysexCallback;
+
+/* private methods ------------------------------ */
+ void processSysexMessage(void);
+ void systemReset(void);
+ void pin13strobe(int count, int onInterval, int offInterval);
+};
+
+extern FirmataClass Firmata;
+
+/*==============================================================================
+ * MACROS
+ *============================================================================*/
+
+/* shortcut for setFirmwareNameAndVersion() that uses __FILE__ to set the
+ * firmware name. It needs to be a macro so that __FILE__ is included in the
+ * firmware source file rather than the library source file.
+ */
+#define setFirmwareVersion(x, y) setFirmwareNameAndVersion(__FILE__, x, y)
+
+/* Hardware Abstraction Layer */
+#include "Boards.h"
+
+#endif /* Firmata_h */
+
3  Firmata2/FirmataForVersion5SensorHubs/IMPORTANT README.txt
@@ -0,0 +1,3 @@
+If using the Arduino UNO, over-write the firmata.h in this path with the firmata.h file from this directory
+
+Your Arduino Instal Directory\arduino-0021\libraries\Firmata
229 Firmata2/FirmataForVersion5SensorHubs/StandardFirmataForUno.pde
@@ -0,0 +1,229 @@
+/* DIY Magic Mirror Firmata Version
+
+ Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See file LICENSE.txt for further informations on licensing terms.
+ */
+
+/*
+ * This is an old version of StandardFirmata (v2.0). It is kept here because
+ * its the last version that works on an ATMEGA8 chip. Also, it can be used
+ * for host software that has not been updated to a newer version of the
+ * protocol. It also uses the old baud rate of 115200 rather than 57600.
+ */
+
+#include <EEPROM.h>
+#include <Firmata.h>
+
+/*==============================================================================
+ * GLOBAL VARIABLES
+ *============================================================================*/
+
+/* analog inputs */
+int analogInputsToReport = 0; // bitwise array to store pin reporting
+int analogPin = 0; // counter for reading analog pins
+
+/* digital pins */
+byte reportPINs[TOTAL_PORTS]; // PIN == input port
+byte previousPINs[TOTAL_PORTS]; // PIN == input port
+byte pinStatus[TOTAL_PINS]; // store pin status, default OUTPUT
+byte portStatus[TOTAL_PORTS];
+
+/* timer variables */
+unsigned long currentMillis; // store the current value from millis()
+unsigned long previousMillis; // for comparison with currentMillis
+
+
+/*==============================================================================
+ * FUNCTIONS
+ *============================================================================*/
+
+void outputPort(byte portNumber, byte portValue)
+{
+ portValue = portValue &~ portStatus[portNumber];
+ if(previousPINs[portNumber] != portValue) {
+ Firmata.sendDigitalPort(portNumber, portValue);
+ previousPINs[portNumber] = portValue;
+ Firmata.sendDigitalPort(portNumber, portValue);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * check all the active digital inputs for change of state, then add any events
+ * to the Serial output queue using Serial.print() */
+void checkDigitalInputs(void)
+{
+ byte i, tmp;
+ for(i=0; i < TOTAL_PORTS; i++) {
+ if(reportPINs[i]) {
+ switch(i) {
+ case 0: outputPort(0, PIND &~ B00000011); break; // ignore Rx/Tx 0/1
+ case 1: outputPort(1, PINB); break;
+ case 2: outputPort(2, PINC); break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets the pin mode to the correct state and sets the relevant bits in the
+ * two bit-arrays that track Digital I/O and PWM status
+ */
+void setPinModeCallback(byte pin, int mode) {
+ byte port = 0;
+ byte offset = 0;
+
+ if (pin < 8) {
+ port = 0;
+ offset = 0;
+ } else if (pin < 14) {
+ port = 1;
+ offset = 8;
+ } else if (pin < 22) {
+ port = 2;
+ offset = 14;
+ }
+
+ if(pin > 1) { // ignore RxTx (pins 0 and 1)
+ pinStatus[pin] = mode;
+ switch(mode) {
+ case INPUT:
+ pinMode(pin, INPUT);
+ portStatus[port] = portStatus[port] &~ (1 << (pin - offset));
+ break;
+ case OUTPUT:
+ digitalWrite(pin, LOW); // disable PWM
+ case PWM:
+ pinMode(pin, OUTPUT);
+ portStatus[port] = portStatus[port] | (1 << (pin - offset));
+ break;
+ //case ANALOG: // TODO figure this out
+ default:
+ Firmata.sendString("");
+ }
+ // TODO: save status to EEPROM here, if changed
+ }
+}
+
+void analogWriteCallback(byte pin, int value)
+{
+ setPinModeCallback(pin,PWM);
+ analogWrite(pin, value);
+}
+
+void digitalWriteCallback(byte port, int value)
+{
+ switch(port) {
+ case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1)
+ // 0xFF03 == B1111111100000011 0x03 == B00000011
+ PORTD = (value &~ 0xFF03) | (PORTD & 0x03);
+ break;
+ case 1: // pins 8-13 (14,15 are disabled for the crystal)
+ PORTB = (byte)value;
+ break;
+ case 2: // analog pins used as digital
+ PORTC = (byte)value;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets bits in a bit array (int) to toggle the reporting of the analogIns
+ */
+//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
+//}
+void reportAnalogCallback(byte pin, int value)
+{
+ if(value == 0) {
+ analogInputsToReport = analogInputsToReport &~ (1 << pin);
+ }
+ else { // everything but 0 enables reporting of that pin
+ analogInputsToReport = analogInputsToReport | (1 << pin);
+ }
+ // TODO: save status to EEPROM here, if changed
+}
+
+void reportDigitalCallback(byte port, int value)
+{
+ reportPINs[port] = (byte)value;
+ if(port == 2) // turn off analog reporting when used as digital
+ analogInputsToReport = 0;
+}
+
+/*==============================================================================
+ * SETUP()
+ *============================================================================*/
+void setup()
+{
+ byte i;
+
+ Firmata.setFirmwareVersion(5, 0);
+
+ Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
+ Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
+ Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
+ Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
+ Firmata.attach(SET_PIN_MODE, setPinModeCallback);
+
+ portStatus[0] = B00000011; // ignore Tx/RX pins
+ portStatus[1] = B11000000; // ignore 14/15 pins
+ portStatus[2] = B00000000;
+
+// for(i=0; i<TOTAL_PINS; ++i) { // TODO make this work with analogs
+ for(i=0; i<14; ++i) {
+ setPinModeCallback(i,OUTPUT);
+ }
+ // set all outputs to 0 to make sure internal pull-up resistors are off
+ PORTB = 0; // pins 8-15
+ PORTC = 0; // analog port
+ PORTD = 0; // pins 0-7
+
+ // TODO rethink the init, perhaps it should report analog on default
+ for(i=0; i<TOTAL_PORTS; ++i) {
+ reportPINs[i] = false;
+ }
+ // TODO: load state from EEPROM here
+
+ /* send digital inputs here, if enabled, to set the initial state on the
+ * host computer, since once in the loop(), this firmware will only send
+ * digital data on change. */
+ if(reportPINs[0]) outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
+ if(reportPINs[1]) outputPort(1, PINB);
+ if(reportPINs[2]) outputPort(2, PINC);
+
+ Firmata.begin(115200);
+}
+
+/*==============================================================================
+ * LOOP()
+ *============================================================================*/
+void loop()
+{
+/* DIGITALREAD - as fast as possible, check for changes and output them to the
+ * FTDI buffer using Serial.print() */
+ checkDigitalInputs();
+ currentMillis = millis();
+ if(currentMillis - previousMillis > 20) {
+ previousMillis += 20; // run this every 20ms
+ /* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
+ * all serialReads at once, i.e. empty the buffer */
+ while(Firmata.available())
+ Firmata.processInput();
+ /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
+ * 60 bytes. use a timer to sending an event character every 4 ms to
+ * trigger the buffer to dump. */
+
+ /* ANALOGREAD - right after the event character, do all of the
+ * analogReads(). These only need to be done every 4ms. */
+ for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
+ if( analogInputsToReport & (1 << analogPin) ) {
+ Firmata.sendAnalog(analogPin, analogRead(analogPin));
+ }
+ }
+ }
+}
227 Firmata2/StandardFirmata.pde
@@ -0,0 +1,227 @@
+/*DIY Magic Mirror Firmata
+
+ Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ See file LICENSE.txt for further informations on licensing terms.
+ */
+
+/*
+ * TODO: add Servo support using setPinMode(pin, SERVO);
+ * TODO: use Program Control to load stored profiles from EEPROM
+ */
+
+#include <EEPROM.h>
+#include <Firmata.h>
+
+/*==============================================================================
+ * GLOBAL VARIABLES
+ *============================================================================*/
+
+/* analog inputs */
+int analogInputsToReport = 0; // bitwise array to store pin reporting
+int analogPin = 0; // counter for reading analog pins
+
+/* digital pins */
+byte reportPINs[TOTAL_PORTS]; // PIN == input port
+byte previousPINs[TOTAL_PORTS]; // PIN == input port
+byte pinStatus[TOTAL_DIGITAL_PINS]; // store pin status, default OUTPUT
+byte portStatus[TOTAL_PORTS];
+
+/* timer variables */
+unsigned long currentMillis; // store the current value from millis()
+unsigned long nextExecuteMillis; // for comparison with currentMillis
+
+
+/*==============================================================================
+ * FUNCTIONS
+ *============================================================================*/
+
+void outputPort(byte portNumber, byte portValue)
+{
+ portValue = portValue &~ portStatus[portNumber];
+ if(previousPINs[portNumber] != portValue) {
+ Firmata.sendDigitalPort(portNumber, portValue);
+ previousPINs[portNumber] = portValue;
+ Firmata.sendDigitalPort(portNumber, portValue);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * check all the active digital inputs for change of state, then add any events
+ * to the Serial output queue using Serial.print() */
+void checkDigitalInputs(void)
+{
+ byte i, tmp;
+ for(i=0; i < TOTAL_PORTS; i++) {
+ if(reportPINs[i]) {
+ switch(i) {
+ case 0: outputPort(0, PIND &~ B00000011); break; // ignore Rx/Tx 0/1
+ case 1: outputPort(1, PINB); break;
+ case ANALOG_PORT: outputPort(ANALOG_PORT, PINC); break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets the pin mode to the correct state and sets the relevant bits in the
+ * two bit-arrays that track Digital I/O and PWM status
+ */
+void setPinModeCallback(byte pin, int mode) {
+ byte port = 0;
+ byte offset = 0;
+
+ if (pin < 8) {
+ port = 0;
+ offset = 0;
+ } else if (pin < 14) {
+ port = 1;
+ offset = 8;
+ } else if (pin < 22) {
+ port = 2;
+ offset = 14;
+ }
+
+ if(pin > 1) { // ignore RxTx (pins 0 and 1)
+ pinStatus[pin] = mode;
+ switch(mode) {
+ case INPUT:
+ pinMode(pin, INPUT);
+ portStatus[port] = portStatus[port] &~ (1 << (pin - offset));
+ break;
+ case OUTPUT:
+ digitalWrite(pin, LOW); // disable PWM
+ case PWM:
+ pinMode(pin, OUTPUT);
+ portStatus[port] = portStatus[port] | (1 << (pin - offset));
+ break;
+ //case ANALOG: // TODO figure this out
+ default:
+ Firmata.sendString("");
+ }
+ // TODO: save status to EEPROM here, if changed
+ }
+}
+
+void analogWriteCallback(byte pin, int value)
+{
+ setPinModeCallback(pin,PWM);
+ analogWrite(pin, value);
+}
+
+void digitalWriteCallback(byte port, int value)
+{
+ switch(port) {
+ case 0: // pins 2-7 (don't change Rx/Tx, pins 0 and 1)
+ // 0xFF03 == B1111111100000011 0x03 == B00000011
+ PORTD = (value &~ 0xFF03) | (PORTD & 0x03);
+ break;
+ case 1: // pins 8-13 (14,15 are disabled for the crystal)
+ PORTB = (byte)value;
+ break;
+ case 2: // analog pins used as digital
+ PORTC = (byte)value;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/* sets bits in a bit array (int) to toggle the reporting of the analogIns
+ */
+//void FirmataClass::setAnalogPinReporting(byte pin, byte state) {
+//}
+void reportAnalogCallback(byte pin, int value)
+{
+ if(value == 0) {
+ analogInputsToReport = analogInputsToReport &~ (1 << pin);
+ }
+ else { // everything but 0 enables reporting of that pin
+ analogInputsToReport = analogInputsToReport | (1 << pin);
+ }
+ // TODO: save status to EEPROM here, if changed
+}
+
+void reportDigitalCallback(byte port, int value)
+{
+ reportPINs[port] = (byte)value;
+ if(port == ANALOG_PORT) // turn off analog reporting when used as digital
+ analogInputsToReport = 0;
+}
+
+/*==============================================================================
+ * SETUP()
+ *============================================================================*/
+void setup()
+{
+ byte i;
+
+ Firmata.setFirmwareVersion(2, 0);
+
+ Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
+ Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
+ Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
+ Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
+ Firmata.attach(SET_PIN_MODE, setPinModeCallback);
+
+ portStatus[0] = B00000011; // ignore Tx/RX pins
+ portStatus[1] = B11000000; // ignore 14/15 pins
+ portStatus[2] = B00000000;
+
+// for(i=0; i<TOTAL_DIGITAL_PINS; ++i) { // TODO make this work with analogs
+ for(i=0; i<14; ++i) {
+ setPinModeCallback(i,OUTPUT);
+ }
+ // set all outputs to 0 to make sure internal pull-up resistors are off
+ PORTB = 0; // pins 8-15
+ PORTC = 0; // analog port
+ PORTD = 0; // pins 0-7
+
+ // TODO rethink the init, perhaps it should report analog on default
+ for(i=0; i<TOTAL_PORTS; ++i) {
+ reportPINs[i] = false;
+ }
+ // TODO: load state from EEPROM here
+
+ /* send digital inputs here, if enabled, to set the initial state on the
+ * host computer, since once in the loop(), this firmware will only send
+ * digital data on change. */
+ if(reportPINs[0]) outputPort(0, PIND &~ B00000011); // ignore Rx/Tx 0/1
+ if(reportPINs[1]) outputPort(1, PINB);
+ if(reportPINs[ANALOG_PORT]) outputPort(ANALOG_PORT, PINC);
+
+ Firmata.begin(115200);
+}
+
+/*==============================================================================
+ * LOOP()
+ *============================================================================*/
+void loop()
+{
+/* DIGITALREAD - as fast as possible, check for changes and output them to the
+ * FTDI buffer using Serial.print() */
+ checkDigitalInputs();
+ currentMillis = millis();
+ if(currentMillis > nextExecuteMillis) {
+ nextExecuteMillis = currentMillis + 19; // run this every 20ms
+ /* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
+ * all serialReads at once, i.e. empty the buffer */
+ while(Firmata.available())
+ Firmata.processInput();
+ /* SEND FTDI WRITE BUFFER - make sure that the FTDI buffer doesn't go over
+ * 60 bytes. use a timer to sending an event character every 4 ms to
+ * trigger the buffer to dump. */
+
+ /* ANALOGREAD - right after the event character, do all of the
+ * analogReads(). These only need to be done every 4ms. */
+ for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
+ if( analogInputsToReport & (1 << analogPin) ) {
+ Firmata.sendAnalog(analogPin, analogRead(analogPin));
+ }
+ }
+ }
+}
BIN  Firmata2/StandardFirmata.zip
Binary file not shown
147 MJPEG.as
@@ -0,0 +1,147 @@
+package
+{
+ import flash.display.Loader;
+ import flash.events.Event;
+ import flash.events.ProgressEvent;
+ import flash.net.Socket;
+ import flash.utils.ByteArray;
+ import com.dynamicflash.util.Base64;
+
+ /**
+ * This is a class used to view a MJPEG
+ * @author Josh Chernoff | GFX Complex
+ *
+ */
+ public class MJPEG extends Loader
+ {
+ private var _user:String; //Auth user name
+ private var _pass:String; //Auth user password
+
+ private var _host:String; //host server of stream
+ private var _port:int; //port of stream
+ private var _file:String; //Location of MJPEG
+ private var _start:int = 0; //marker for start of jpg
+
+ private var webcamSocket:Socket = new Socket(); //socket connection
+ private var imageBuffer:ByteArray = new ByteArray(); //image holder
+
+ /**
+ * Create's a new instance of the MJPEG class. Note that due a sandbox security problem, unless you can place a crossdomain.xml
+ * on the host server you will only be able to use this class in your AIR applications.
+ *
+ * @example import MJPEG;
+ * var cam:MJPEG = new MJPEG("192.168.0.100", "/img/video.mjpeg", 80);
+ * addChild(cam);
+ *
+ * @param host:String | Host of the server. Do not include protocol
+ * @param file:String | Path to the file on the server. Start with a forward slash
+ * @param port:int | Port of the host server;
+ * @param user:String | User name for Auth
+ * @param pass:String | User password for Auth
+ */
+ public function MJPEG (host:String, file:String, port:int = 80, user:String = null, pass:String = null )
+ {
+ _host = host;
+ _file = file;
+ _port = port;
+ _user = user;
+ _pass = pass;
+
+ webcamSocket.addEventListener(Event.CONNECT, handleConnect);
+ webcamSocket.addEventListener(ProgressEvent.SOCKET_DATA, handleData);
+ webcamSocket.connect(host, port);
+
+ }
+
+ private function handleConnect(e:Event):void
+ {
+ // we're connected send a request
+ var httpRequest:String = "GET "+_file+" HTTP/1.1\r\n";
+ httpRequest+= "Host: localhost:80\r\n";
+ if(_user != null && _pass != null){
+ var source:String = String(_user + ":" + _pass);
+ var auth:String = Base64.encode(source);
+ httpRequest += "Authorization: Basic " + auth.toString()+ "\r\n"; //NOTE THIS MAY NEEED TO BE EDITED TO WORK WITH YOUR CAM
+ }
+ httpRequest+="Connection: keep-alive\r\n\r\n";
+ webcamSocket.writeMultiByte(httpRequest, "us-ascii");
+ }
+
+ function handleData(e:ProgressEvent):void {
+ //trace("Got Data!" + e);
+ // get the data that we received.
+
+ // append the data to our imageBuffer
+ webcamSocket.readBytes(imageBuffer, imageBuffer.length);
+ //trace(imageBuffer.length);
+ while(findImages()){
+ //donothing
+ }
+
+
+ }
+
+
+ private function findImages():Boolean
+ {
+
+ var x:int = _start;
+ var startMarker:ByteArray = new ByteArray();
+ var end:int = 0;
+ var image:ByteArray;
+
+ if (imageBuffer.length > 1) {
+ if(_start == 0){
+ //Check for start of JPG
+ for (x; x < imageBuffer.length - 1; x++) {
+
+ // get the first two bytes.
+ imageBuffer.position = x;
+ imageBuffer.readBytes(startMarker, 0, 2);
+
+ //Check for end of JPG
+ if (startMarker[0] == 255 && startMarker[1] == 216) {
+ _start = x;
+ break;
+ }
+ }
+ }
+ for (x; x < imageBuffer.length - 1; x++) {
+ // get the first two bytes.
+ imageBuffer.position = x;
+ imageBuffer.readBytes(startMarker, 0, 2);
+ if (startMarker[0] == 255 && startMarker[1] == 217){
+
+ end = x;
+
+ image = new ByteArray();
+ imageBuffer.position = _start;
+ imageBuffer.readBytes(image, 0, end - _start);
+
+ displayImage(image);
+
+ // truncate the imageBuffer
+ var newImageBuffer:ByteArray = new ByteArray();
+
+ imageBuffer.position = end;
+ imageBuffer.readBytes(newImageBuffer, 0);
+ imageBuffer = newImageBuffer;
+
+ _start = 0;
+ x = 0;
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private function displayImage(image:ByteArray):void
+ {
+ this.loadBytes(image);
+ }
+
+ }
+
+}
0  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/.Clean
No changes.
134 ...ue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Info.plist
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en_US</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>swf</string>
+ <string>spl</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>document</string>
+ <key>CFBundleTypeName</key>
+ <string>Shockwave Flash Movie</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>SWFL</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>flv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>mflv</string>
+ <key>CFBundleTypeName</key>
+ <string>Macromedia Flash Video</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>MFLV</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>None</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>f4v</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>document_f4v.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>video/mp4</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Video for Adobe Flash Player</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>F4V</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>None</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>f4p</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>document_f4p.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>video/mp4</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Protected Media for Adobe Flash Player</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>F4P</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>f4a</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>document_f4a.icns</string>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>audio/mp4</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>Audio for Adobe Flash Player</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>F4A</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>Flash Player</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Adobe Flash Player 10.0 r22 Copyright (c) 1996-2009 Adobe Macromedia Software LLC. All rights reserved</string>
+ <key>CFBundleIconFile</key>
+ <string>icon</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.macromedia.Flash Player.app</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>Adobe Flash Player 10.0 r22</string>
+ <key>CFBundleName</key>
+ <string>Flash Player</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>10.0.22.87</string>
+ <key>CFBundleSignature</key>
+ <string>SWF2</string>
+ <key>CFBundleVersion</key>
+ <string>10.0</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSPrefersCarbon</key>
+ <string>YES</string>
+ <key>NSAppleScriptEnabled</key>
+ <string>YES</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright 1996-2009 Adobe Systems Incorporated and its licensors. All Rights Reserved.</string>
+</dict>
+</plist>
BIN  ...no_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/MacOS/Flash Player
Binary file not shown
1  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPLSWF2
BIN  ...e_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/Flash Player.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/cs.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/de.lproj/Localized.rsrc
Binary file not shown
BIN  ...3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/document.icns
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/en.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/es.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/fr.lproj/Localized.rsrc
Binary file not shown
BIN  ...o_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/icon.icns
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/it.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ja.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ko.lproj/Localized.rsrc
Binary file not shown
BIN  ...o_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/mflv.icns
Binary file not shown
BIN  ...o_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/movie.swf
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/nl.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/pl.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/pt.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/ru.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/sv.lproj/Localized.rsrc
Binary file not shown
BIN  ...le_v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/tr.lproj/Localized.rsrc
Binary file not shown
BIN  ...v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/zh_CN.lproj/Localized.rsrc
Binary file not shown
BIN  ...v1.6/monitor/as3glue_standalone_monitor.app/Contents/Resources/zh_TW.lproj/Localized.rsrc
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/monitor/as3glue_standalone_monitor.exe
Binary file not shown
176 as3glue/arduino_as3glue_bundle_v1.6/readme.rtf
@@ -0,0 +1,176 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww24920\viewh12860\viewkind1
+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
+
+\f0\b\fs24 \cf0 Arduino with Flash communication bundle v1.6 - 11-02-2011 \
+
+\i\b0 http://www.kasperkamperman.com/blog/arduino/arduino-flash-communication-as3/\
+
+\i0 ================================================================\
+\
+
+\b Included files :
+\b0 \
+\
+
+\b FlashFiles
+\b0 \
+- as3glue (
+\i http://code.google.com/p/as3glue/
+\i0 ) \
+- monitor objects (
+\i http://www.kasperkamperman.com
+\i0 )\
+- programming example \
+- standalone monitor source code\
+\
+
+\b Standalone monitor
+\b0 \
+- .app (osx), .exe (windows)\
+\
+
+\b Serproxy
+\b0 \
+- Osx version : Tinkerproxy ( renamed to Serproxy )\
+ (
+\i http://code.google.com/p/tinkerit/wiki/TinkerProxy
+\i0 )\
+- Windows version : Serialproxy 0.1.4 ( renamed to Serproxy )\
+ (
+\i http://www.cote.cc/blog/serialproxy-v014-can-use-com-ports-above-9
+\i0 )\
+\
+This library is made as a simple start up for the classes Physical Computing at Saxion - Enschede, The Netherlands ( course Art & Technology ). \
+\
+Make sure to check out the resources of the individual packages above and the Arduino playground for more communication options. \
+
+\i http://www.arduino.cc/playground/Interfacing/Flash
+\i0 \
+
+\b \
+
+\b0 ================================================================
+\b \
+\
+What does it do ?
+\b0 \
+\
+Glue is an ActionScript 3 library that enables communication between Flash and Arduino boards. Since Flash cannot interface the serial port directly you'll need a proxy program in between that converts incoming serial data the XMLsocket data. \
+\
+The monitor is useful to check if all the connections are working good. You can monitor directly all the sensors and actuators connected to your Arduino board. \
+\
+The example code file is a start point to program your own things controlled by Arduino. \
+\
+================================================================\
+\
+
+\b How to get it to work ?
+\b0 \
+\
+\
+\
+\
+Steps :\
+\
+0. Download Arduino from arduino.cc. Use Arduino 018 or higher. The Firmata library included with Arduino 017 is not stable. \
+\
+1. Upload StandardFirmata (included with Arduino) to the Arduino board. \
+ File > Sketchbook > Examples > Firmata > StandardFirmata\
+ \
+2. Edit serproxy.cfg ( see also the comments in this file ). Commented lines start with the number sign ( # )\
+ \
+ You can find the serialport of Arduino in the Arduino IDE under \
+ Tools/SerialPort/\
+\
+ Osx : Make sure you start with "cu.usbserial" instead of "tty.usbserial" in serproxy.cfg\
+ \
+ By changing the setup for either windows or osx and change the serialport number/name. \
+\
+ If you see : "Couldn't find 'comm_ports' entry in config file" \
+ Make sure you uncomment ( remove # symbol in front of the line ) the comm_ports entry. \
+ \
+3. Run serproxy. If you see firewall dialogs, choose unblock\
+\
+4. Try to run as3glue_standalone_monitor. If you did the serproxy configuration good, you are supposed to see some movement. \
+ Set output pin 13 to high to see the onboard led on the Arduino. \
+\
+5. If you run an .swf outside of the Flash IDE, you probably get some security messages. \
+\
+
+\b Security messages
+\b0 \
+ \
+ If you run an .swf from Explorer/Finder you'll probably get a "Flash Player Security" pop-up. \
+\
+ Try to run your program as .exe or .app. \
+ More info : \
+ http://tiny.cc/as3glue_security \
+\
+
+\b Code your own project
+\b0 \
+\
+Make sure the net ( As3Glue code ) and the com ( monitor code ) folders are in the same directory as your Flash files. The example code uses the classes in those folders to compile and run the code. \
+\
+\
+================================================================\
+\
+
+\b AS3Glue copyrights
+\b0 \
+\
+Copyright (c) 2007-2008 Erik Sjodin, eriksjodin.net, Bjoern Hartmann bjoern.org\
+\
+Permission is hereby granted, free of charge, to any person obtaining a copy\
+of this software and associated documentation files (the "Software"), to deal\
+in the Software without restriction, including without limitation the rights\
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\
+copies of the Software, and to permit persons to whom the Software is\
+furnished to do so, subject to the following conditions:\
+\
+The above copyright notice and this permission notice shall be included in\
+all copies or substantial portions of the Software.\
+\
+Glue is an open source library licensed under the above MIT licence.\
+\
+================================================================\
+\
+
+\b Monitor and example code
+\b0 \
+\
+Copyleft 2009 Kasper Kamperman, http://www.kasperkamperman.com \
+Art & Technology - Saxion, University of Professional Education - NL, Enschede\
+ \
+
+\b Serproxy - osx version
+\b0 \
+\
+Serproxy 0.2.0 - Tinker.it \
+Based on code by (C)1999 Stefano Busti, (C)2005 David A. Mellis\
+\
+http://code.google.com/p/tinkerit/downloads/detail?name=tinkerproxy-2_0.zip\
+\
+
+\b Serproxy - windows version
+\b0 \
+\
+Serproxy 0.1.4\
+\
+Stefano Busti (sbusti@nildram.co.uk)\
+Modified by: David A. Mellis (dam@mellis.org)\
+ Jean-Philippe Cote (jp@cote.cc)\
+ \
+http://www.cote.cc/blog/serialproxy-v014-can-use-com-ports-above-9\
+\
+
+\b Firmata ( not included )
+\b0 \
+\
+www.firmata.org \
+License see license.txt in the folder\
+\
+================================================================}
BIN  as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy
Binary file not shown
57 as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy.cfg
@@ -0,0 +1,57 @@
+# Config file for serproxy
+# Original documentation not included you can download the original package at
+# http://www.arduino.cc/en/Main/Software
+#
+# Change the settings below for your configuration
+
+# Transform newlines coming from the serial port into nils
+# if using Flash AS2 or AS1 : true
+# if using Flash AS3 : false
+newlines_to_nils=false
+
+# Same number as in Serial.begin() in the Arduino code
+# With StandardFirmata try 57600 or (older Arduino versions) 115200
+comm_baud=57600
+comm_databits=8
+comm_stopbits=1
+comm_parity=none
+
+# Idle time out in seconds
+timeout=300
+
+# Different configuration for Mac and Windows
+# Change the settings and make sure you comment everything
+# of the OS you don't use.
+
+# == WINDOWS ===============================================================
+#
+# Choose the COMport where Arduino is connected
+# You can find this in the Arduino IDE Tool - Serialport
+# Change the net_port number in the same number as the serialport number at the "comm_ports" line
+# example : if comm_ports=3 -> net_port3=5331
+# decomment below................
+
+#comm_ports=3
+#net_port3=5331
+
+# == OSX ===================================================================
+#
+# decomment ONE of the two lines below
+# change the part marked with $ in the number of your device
+# You can find the serial_device name in the Arduino IDE Tool - Serialport
+# example Arduino Duemilanove and older:
+# serial_device1=/dev/cu.usbserial-A6008rZN
+# example Arduino UNO:
+# serial_device1=/dev/cu.usbmodem641
+
+#serial_device1=/dev/cu.usbserial-$$$$$$$$
+#serial_device1=/dev/cu.usbmodem$$$
+
+# decomment below
+
+#comm_ports=1
+#net_port1=5331
+
+
+
+
BIN  as3glue/arduino_as3glue_bundle_v1.6/serproxy/serproxy.exe
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.fla
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.pdf
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_program-example.swf
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_standalone_monitor.fla
Binary file not shown
BIN  as3glue/arduino_as3glue_bundle_v1.6/source/as3glue_standalone_monitor.swf
Binary file not shown
34 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/ArduinoMonitor.as
@@ -0,0 +1,34 @@
+package com.kasperkamperman.monitor
+{ /* Monitor object
+ Problem switch servo - pwm doens't work without restarting.
+ */
+
+
+ import flash.display.*;
+ import flash.events.*;
+
+ import net.eriksjodin.arduino.ArduinoWithServo;
+ import net.eriksjodin.arduino.events.ArduinoEvent;
+ import net.eriksjodin.arduino.events.ArduinoSysExEvent;
+
+ import com.kasperkamperman.monitor.PinConfigObj;
+ import com.kasperkamperman.monitor.PinMonitorObj;
+
+ import fl.controls.Button;
+
+ public class ArduinoMonitor extends MovieClip
+ {
+
+ private var _ioPin:int;
+ private var _ioPinName:String;
+ private var _ioPinText:String;
+
+ private var _a:ArduinoWithServo;
+
+ private var _defaultCfg:Array;
+ private var _monitorObject:PinMonitorObj;
+ private var _monitorObjectsArray:Array = new Array();
+
+ private var _configObject:PinConfigObj;
+ private var _configObjectsArray:Array = new Array();
+
25 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/PinConfigObj.as
@@ -0,0 +1,25 @@
+package com.kasperkamperman.monitor
+{ import flash.display.*;
+ import flash.events.*;
+ import fl.controls.ComboBox;
+ import fl.data.DataProvider;
+ import flash.text.*;
+
+ import net.eriksjodin.arduino.events.ArduinoEvent;
+ import net.eriksjodin.arduino.Arduino;
+ import net.eriksjodin.arduino.ArduinoWithServo;
+
+ import com.kasperkamperman.monitor.PinMonitorObj;
+
+ public class PinConfigObj extends MovieClip
+ { private var _dp:DataProvider;
+ private var _cb:ComboBox;
+ private var _txFmt:TextFormat
+ private var _tx:TextField;
+ private var _bgrd:Sprite;
+
+ private var _ioPin:int;
+ private var _ioPinName:String;
+ private var _ioPinText:String;
+
+ private var _monitorObject:PinMonitorObj;
9 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/PinMonitorObj.as
@@ -0,0 +1,9 @@
+package com.kasperkamperman.monitor
+{ import flash.display.*;
+ import flash.events.*;
+ import flash.text.*;
+
+ import fl.controls.Button;
+ import fl.events.ComponentEvent;
+
+ import fl.controls.ProgressBar;
16 as3glue/arduino_as3glue_bundle_v1.6/source/com/kasperkamperman/monitor/WavePlot.as
@@ -0,0 +1,16 @@
+package com.kasperkamperman.monitor
+{ import flash.display.Sprite;
+ import flash.display.Graphics;
+ import flash.utils.Timer;
+ import flash.events.*;
+ import flash.text.*;
+
+ public class WavePlot extends Sprite
+ { private var _g:Graphics;
+ private var _refreshTimer:Timer;
+ private var _waveHeight:int;
+ private var _waveWidth:int;
+ private var _values:Array;
+ private var _col:uint;
+ private var _inputVal:Number;
+ private var _scaleFactor:Number;
4 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/Arduino.as
@@ -0,0 +1,4 @@
+ /*
+ * Copyright 2007-2008 (c) Erik Sjodin, eriksjodin.net and Bjoern Hartmann, bjoern.org
+ *
+ * Permission is hereby granted, free of charge, to any person
65 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/ArduinoWithServo.as
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 (c) 2008 Bjoern Hartmann, bjoern.org
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+package net.eriksjodin.arduino {
+
+ import net.eriksjodin.arduino.Arduino;
+ import flash.net.Socket;
+ import flash.events.ProgressEvent;
+ import net.eriksjodin.arduino.events.ArduinoEvent;
+ import net.eriksjodin.arduino.events.ArduinoSysExEvent;
+ import flash.utils.ByteArray;
+ import net.eriksjodin.helpers.Log;
+
+ /**
+ * ArduinoWithServo class is a proxy objecr for Firmata2 protocol
+ * and StandardPlusServoFirmata firmware (included with this project).
+ * Currently only works on pins 9 or 10.
+ * @author Bjoern Hartmann, bjoern.org
+ */
+ public class ArduinoWithServo extends Arduino {
+ public static const SERVO : int = 4;
+ private static const SERVO_CONFIG:int =0x70;
+ public function ArduinoWithServo(host:String = "127.0.0.1", port:int = 5331) {
+ super(host,port);
+ }
+
+ //Send SysEx Message to configure servo
+ public function setupServo(pin:Number, angle:Number, minPulse:Number=544, maxPulse:Number=2400) {
+ if(!(pin==9 || pin==10)) {
+ trace("ArduinoWithServo error: can only attach servo to pins 9 or 10.");
+ return;
+ }
+ /*TODO: i believe min, max have to be divisible by 16 */
+ writeByte(ARD_SYSEX_MESSAGE_START);
+ writeByte(SERVO_CONFIG);
+ writeByte(int(pin));
+ writeIntAsTwoBytes(int(minPulse));
+ writeIntAsTwoBytes(int(maxPulse));
+ writeIntAsTwoBytes(int(angle));
+ writeByte(ARD_SYSEX_MESSAGE_END);
+ flush();
+ }
+ }
+}
86 as3glue/arduino_as3glue_bundle_v1.6/source/net/eriksjodin/arduino/events/ArduinoEvent.as
<
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2007 (c) Erik Sjodin, eriksjodin.net
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *