Skip to content
Snippets Groups Projects
Select Git revision
  • 65504110a4ddf2bffe24c58f24c5a68bc6ffe126
  • main default protected
  • phhw
  • captouch-threshold
  • t
  • dos
  • test2
  • test
  • slewtest
  • simtest
  • view-think
  • vm-pending
  • media-buf
  • scope
  • passthrough
  • wave
  • vsync
  • dos-main-patch-50543
  • json-error
  • rahix/big-flow3r
  • pippin/media_framework
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
34 results

main.py

Blame
  • Forked from flow3r / flow3r firmware
    Source project has a limited visibility.
    accellog.py NaN GiB
    # log the accelerometer values to a .csv-file on the SD-card
    
    import pyb
    
    accel = pyb.Accel()                                 # create object of accelerometer
    blue = pyb.LED(4)                                   # create object of blue LED
    
    log = open('1:/log.csv', 'w')                       # open file to write data - 1:/ ist the SD-card, 0:/ the internal memory
    blue.on()                                           # turn on blue LED
    
    for i in range(100):                                # do 100 times (if the board is connected via USB, you can't write longer because the PC tries to open the filesystem which messes up your file.)
            t = pyb.millis()                            # get time since reset
            x, y, z = accel.filtered_xyz()              # get acceleration data
            log.write('{},{},{},{}\n'.format(t,x,y,z))  # write data to file
    
    log.close()                                         # close file
    blue.off()                                          # turn off LED