Activities/Turtle Art/Programmable Brick: Difference between revisions

Tonyforster (talk | contribs)
Tonyforster (talk | contribs)
Line 204: Line 204:
         tw.lc.heap.append(-1)
         tw.lc.heap.append(-1)


Look in /sys/devices on your computer to find other devices you may be able to access.  
Look in /sys/devices on your computer to find other devices you may be able to access.


Also you can access the following events on the X0-1.75, (some on X0-1.0 -1.5)
You can use the od (octal dump) command to inspect these events, eg
sudo od /dev/input/event0
 
You can access the following events on the X0-1.75, (some on X0-1.0 -1.5)
* accelerometer: /dev/input/event0 ???
* accelerometer: /dev/input/event0 ???
* power button: /dev/input/event1
* power button: /dev/input/event1
Line 215: Line 218:
* rotate, cursor, and game pad keys: /dev/input/event10
* rotate, cursor, and game pad keys: /dev/input/event10
* mouse : /dev/input/mice
* mouse : /dev/input/mice
For example, the code below waits till the ebook switch state changes and pushes the status to the heap


  def myblock(tw, x):  # ignores second argument
  def myblock(tw, x):  # ignores second argument