MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / get_id

Method get_id

Software/Python/gopigo3.py:371–386  ·  view source on GitHub ↗

Read the 128-bit GoPiGo3 hardware serial number Returns touple: serial number as 32 char HEX formatted string, error

(self)

Source from the content-addressed store, hash-verified

369 return ("%d.%d.%d" % ((version / 1000000), ((version / 1000) % 1000), (version % 1000)))
370
371 def get_id(self):
372 """
373 Read the 128-bit GoPiGo3 hardware serial number
374
375 Returns touple:
376 serial number as 32 char HEX formatted string, error
377 """
378 outArray = [self.SPI_Address, self.SPI_MESSAGE_TYPE.GET_ID,\
379 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
380 reply = self.spi_transfer_array(outArray)
381 if(reply[3] == 0xA5):
382 return ("%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X" % \
383 (reply[4], reply[5], reply[6], reply[7], reply[8], reply[9], reply[10], reply[11], \
384 reply[12], reply[13], reply[14], reply[15], reply[16], reply[17], reply[18], reply[19]))
385 raise IOError("No SPI response")
386 return "00000000000000000000000000000000"
387
388 def set_led(self, led, red, green = 0, blue = 0):
389 """

Callers 1

Read_Info.pyFile · 0.45

Calls 1

spi_transfer_arrayMethod · 0.95

Tested by

no test coverage detected