repo.or.cz
/
cerebrum.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
updated the todo file
[cerebrum.git]
/
foo.py
blob
196f2c9c9f1862ca768d00e7d573cd27f178f0de
1
#!/usr/bin/env python
2
import
serial
3
import
sys
4
import
time
5
ser
=
serial
.
Serial
(
"/dev/ttyACM0"
,
57600
)
6
7
#val = 0;
8
#while True:
9
# ser.write('a')
10
# ser.write(chr(0))
11
# ser.write(chr(val))
12
# ser.write('\n')
13
# val+=1
14
# val%=256
15
# time.sleep(0.25);
16
17
while True
:
18
val
=
int
(
sys
.
stdin
.
readline
())
19
print
'a'
,
20
print
ord
(
chr
(
0
)),
21
print
ord
(
chr
(
val
))
22
ser
.
write
(
'a'
)
23
ser
.
write
(
chr
(
0
))
24
ser
.
write
(
chr
(
val
))
25
ser
.
write
(
'
\n
'
)
26
print
ser
.
readline
()