Attachment 'test_adcr.py'

Download

   1 #!/usr/bin/env python3
   2 # 2013-12-09 RR file: test_adcr.py
   3 # ADC is an Arduino ATtiny85-20
   4 # Arduino sketch is ADCtiny85r.ino
   5 # https://github.com/quick2wire/quick2wire-python-api
   6 
   7 import sys
   8 from contextlib import closing
   9 from time import sleep
  10 import quick2wire.i2c as i2c
  11 
  12 address = 0x05
  13 
  14 with i2c.I2CMaster() as bus:
  15     try:
  16         bus.transaction(i2c.writing_bytes(address,  0x03))
  17         sleep(.01)
  18         adata_h, adata_l, rdy_n  = bus.transaction(i2c.reading(address, 3))[0]
  19         # if no fresh data, loop for them
  20         while (rdy_n & 128):
  21             sleep(.01)
  22             adata_h, adata_l, rdy_n = bus.transaction(i2c.reading(address,3))[0]
  23         aval = (adata_h * 0x100) + adata_l
  24         print (hex(aval), aval)
  25         bus.close
  26     except IOError as errno:
  27         print(errno, "line: ", sys.exc_info()[2].tb_lineno )
  28         bus.close

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2013-12-15 10:07:00, 3.0 KB) [[attachment:ADCNano3.ino]]
  • [get | view] (2013-12-15 09:17:00, 3.5 KB) [[attachment:ADCtiny85r.ino]]
  • [get | view] (2013-12-15 23:44:00, 89.1 KB) [[attachment:ATmega_I2C_0A03_IMAG0189.jpg]]
  • [get | view] (2013-12-15 10:41:00, 129.5 KB) [[attachment:ATtiny_I2C_0A03_IMAG0188.jpg]]
  • [get | view] (2014-01-21 16:36:00, 122.5 KB) [[attachment:PHSNA_PLX_DAQ_10_7_5V.PNG]]
  • [get | view] (2014-08-08 17:25:00, 38.7 KB) [[attachment:Wobbulator_Front_DSC05423.jpg]]
  • [get | view] (2014-03-18 08:46:00, 99.6 KB) [[attachment:Wobbulator_Prototyp2_DSC05176.jpg]]
  • [get | view] (2013-12-19 15:02:00, 65.1 KB) [[attachment:Wobbulator_Prototyp_DSC05047.jpg]]
  • [get | view] (2014-08-08 17:07:00, 83.8 KB) [[attachment:Wobbulator_oben_DSC05421.jpg]]
  • [get | view] (2013-12-15 10:18:00, 0.8 KB) [[attachment:test_adc.py]]
  • [get | view] (2013-12-15 09:32:00, 0.8 KB) [[attachment:test_adcr.py]]
  • [get | view] (2014-08-09 08:23:00, 55.6 KB) [[attachment:wob_logamp.brd]]
  • [get | view] (2014-08-09 08:23:00, 58.8 KB) [[attachment:wob_logamp.eps]]
  • [get | view] (2014-08-09 08:23:00, 322.8 KB) [[attachment:wob_logamp.sch]]
  • [get | view] (2014-08-09 08:22:00, 33.0 KB) [[attachment:wob_logamp_sch.pdf]]
  • [get | view] (2014-08-09 08:25:00, 119.2 KB) [[attachment:wob_logamp_sch.png]]
  • [get | view] (2014-08-08 17:54:00, 25.2 KB) [[attachment:wobbulator2.6.3.py]]
  • [get | view] (2014-04-05 19:10:00, 271.0 KB) [[attachment:wobbulatorM.sch]]
  • [get | view] (2014-04-05 19:09:00, 28.9 KB) [[attachment:wobbulatorM_sch.pdf]]
  • [get | view] (2014-04-05 19:09:00, 74.7 KB) [[attachment:wobbulatorM_sch.png]]
  • [get | view] (2014-08-08 14:27:00, 31.8 KB) [[attachment:wobbulator_10.7MA_limits.png]]
  • [get | view] (2014-08-08 17:06:00, 83.8 KB) [[attachment:wobbulator_DSC05418.jpg]]
  • [get | view] (2014-04-05 18:28:00, 29.5 KB) [[attachment:wobbulator_limits_0-60dB_5V.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.