Changes

Jump to navigation Jump to search

T200 software

1,199 bytes added, 15:04, 26 June 2020
Created page with "{{GD Template Impl}} <pre> sudo apt-get update sudo apt-get install python-pip sudo pip install Jetson.GPIO sudo apt-get install libi2c-dev i2c-tools sudo i2cdetect -y -r 1..."
{{GD Template Impl}}

<pre>
sudo apt-get update

sudo apt-get install python-pip
sudo pip install Jetson.GPIO

sudo apt-get install libi2c-dev i2c-tools
sudo i2cdetect -y -r 1

pip install smbus

sudo apt-get install nano

# sample code

'#!/usr/bin/env python
import struct
import smbus
import sys
import time


def readVoltage(bus):

address = 0x36
read = bus.read_word_data(address, 2)
swapped = struct.unpack("<H", struct.pack(">H", read))[0]
voltage = swapped * 1.25 /1000/16
return voltage


def readCapacity(bus):

address = 0x36
read = bus.read_word_data(address, 4)
swapped = struct.unpack("<H", struct.pack(">H", read))[0]
capacity = swapped/256
return capacity


bus = smbus.SMBus(1) # 0 = /dev/i2c-0 (port I2C0), 1 = /dev/i2c-1 (port I2C1)

while True:

print "******************"
print "Voltage:%5.2fV" % readVoltage(bus)

print "Battery:%5i%%" % readCapacity(bus)

if readCapacity(bus) == 100:

print "Battery FULL"

if readCapacity(bus) < 20:


print "Battery LOW"
print "******************"
time.sleep(2)
</pre>

<!--Add review function! -->
<comments />

[[Category:Product Manual]]
[[Category:Jetson Nano]]

Navigation menu