There's not comunication beetwen raspberry pi 3 y qik 2s12v10

im trying to use my qik 2s12v10 qith my raspberry pi 3b and its not working on.I have used before with arduino and it’s working. I think that its no receiving what im trying to send by the serial port. Here is the code.

#! /usr/bin/python
import serial
import time
ser = serial.Serial(’/dev/ttyS0’, 115200, timeout=0.5) # open serial port
a1=‘AA0A086F’
arr = bytes(a1, ‘utf-8’)
print(arr)
ser.write(arr)
time.sleep(2)
a4=‘AA0A0800’
arr1 = bytes(a4, ‘utf-8’)
print(arr1)
ser.write(arr1) # motor 0 speed to 0
time.sleep(1)
ser.close()

The physical conections are right. These are in the same way that are mentions in preview reviews.

I have use other code before:

import serial
import time

s = serial.Serial("/dev/ttyS0", 115200, timeout=0.5)
s.write( chr(0xAA) + chr(0x09) + chr(0x0A) + chr(0x7F) ) # motor 0 full speed reverse
time.sleep(2)
s.write( chr(0xAA) + chr(0x09) + chr(0x0A) + chr(0x00) ) # motor 0 stop
s.close()

But I obtain this error

image

Hello,

It looks like you are not properly representing the bytes you want to send to the Qik in your Python program. Something like this should work for you:

#! /usr/bin/python
import serial
import time
ser = serial.Serial('/dev/ttyS0', 115200, timeout=0.5) # open serial port
arr = [0xAA, 0x0A, 0x08, 0x6F]
print(arr)
ser.write(arr)
time.sleep(2)
arr1 = [0xAA, 0x0A, 0x08, 0x00]
print(arr1)
ser.write(arr1) # motor 0 speed to 0
time.sleep(1)
ser.close()

Kevin

Thanks so much, now It’s working.