-
Notifications
You must be signed in to change notification settings - Fork 0
/
motores.lisp
121 lines (108 loc) · 3.96 KB
/
motores.lisp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
(defun motorZero(nomeArquivo)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" 0))
)
)
(defun motorNoventa(nomeArquivo)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" 90))
)
)
(defun modificaArquivo(nomeArquivo valor)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fd buf)
(let* ((leitura (read-line fd))
(valorAnt (parse-integer leitura)))
(cond ((or ;(and (> (+ valor valorAnt) -180) (< (+ valor valorAnt) 0))
(and (< (+ valor valorAnt) 90) (> (+ valor valorAnt) -90))
)
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" (+ valorAnt valor)))
))
))))
(defun modificaArquivoM4(nomeArquivo valor)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fd buf)
(let* ((leitura (read-line fd))
(valorAnt (parse-integer leitura)))
(cond ((or ;(and (> (+ valor valorAnt) -180) (< (+ valor valorAnt) 0))
(and (< (+ valor valorAnt) 120) (> (+ valor valorAnt) -95))
)
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" (+ valorAnt valor)))
))
))))
(defun modificaArquivoM12(nomeArquivo valor)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fd buf)
(let* ((leitura (read-line fd))
(valorAnt (parse-integer leitura)))
(cond ((or (and (> (+ valor valorAnt) -180) (< (+ valor valorAnt) 0))
;(and (< (+ valor valorAnt) 90) (> (+ valor valorAnt) -90))
)
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" (+ valorAnt valor)))
))
))))
(defun modificaArquivoM5(nomeArquivo valor)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fd buf)
(let* ((leitura (read-line fd))
(valorAnt (parse-integer leitura)))
(cond ((or (and (> (+ valor valorAnt) -135) (< (+ valor valorAnt) -55))
;(and (< (+ valor valorAnt) 90) (> (+ valor valorAnt) -90))
)
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" (+ valorAnt valor)))
))
))))
(defun modificaArquivo2(nomeArquivo valor)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fdEscrita buf :direction :output :if-exists :supersede)
(format fdEscrita "~s" valor))
)
)
(defun lerMotor(nomeArquivo)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
nomeArquivo)))
(with-open-file (fd buf)
(let* ((leitura (read-line fd))
(valor (parse-integer leitura)))
valor
))
))
(defun pegarPosicao (lista)
(let ((px (fourth (first lista)))
(py (fourth (second lista)))
(pz (fourth (third lista))))
(list px py pz)
))
(defun lerIP()
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
"ipEndereco")))
(with-open-file (fd buf)
(read-line fd))))
(defun escreverIP(novoIp)
(let ((buf (concatenate 'string "/root/micro/"
;"/home/cecilia/Dropbox/7periodo/Micro/trabalho/usando/"
"ipEndereco")))
(with-open-file (fd buf :direction :output :if-exists :supersede)
(format fd "~s" novoIp ))))