forked from DexterInd/GoPiGo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardware_test_2.py
More file actions
executable file
·58 lines (50 loc) · 1.51 KB
/
hardware_test_2.py
File metadata and controls
executable file
·58 lines (50 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
# This program is for testing GoPiGo Hardware.
'''
## License
GoPiGo for the Raspberry Pi: an open source robotics platform for the Raspberry Pi.
Copyright (C) 2017 Dexter Industries
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
'''
from __future__ import print_function
from __future__ import division
from builtins import input
# the above lines are meant for Python3 compatibility.
# they force the use of Python3 functionality for print(),
# the integer division and input()
# mind your parentheses!
from gopigo import *
import sys
import atexit
atexit.register(stop)
print ("Both motors moving Forward with LED On")
led_on(0)
led_on(1)
fwd()
time.sleep(5)
print ("Both motors stopped with LED Off")
led_off(0)
led_off(1)
stop()
time.sleep(2)
print ("Both motors moving back with LED On")
led_on(0)
led_on(1)
bwd()
time.sleep(5)
print ("Both motors stopped with LED Off")
led_off(0)
led_off(1)
stop()
time.sleep(2)
stop()
stop()