File: test-serial-mbot.py

package info (click to toggle)
visp 3.7.0-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 166,384 kB
  • sloc: cpp: 392,705; ansic: 224,448; xml: 23,444; python: 13,701; java: 4,792; sh: 207; objc: 145; makefile: 118
file content (24 lines) | stat: -rw-r--r-- 446 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python

import time
import serial

ser = serial.Serial(
  port='/dev/ttyAMA0',
  baudrate = 9600,
)

x = ser.write('MOTOR_RPM=-100,100\n')
time.sleep(0.5)
x = ser.write('MOTOR_RPM=-50,100\n')
time.sleep(0.5)
x = ser.write('MOTOR_RPM=50,-50\n')
time.sleep(0.5)
x = ser.write('LED_RING=0,0,10,0\n')
time.sleep(0.5)
x = ser.write('LED_RING=0,0,0,10\n')
time.sleep(0.5)
x = ser.write('LED_RING=0,0,0,0\n')
time.sleep(0.5)
ser.close()