Skip to content

Commit b9a279a

Browse files
committedJun 28, 2017
first one
0 parents  commit b9a279a

File tree

7 files changed

+88
-0
lines changed

7 files changed

+88
-0
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.swp
2+
.editorconfig

‎LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Marino Hohenheim
4+
Copyright (c) 2017 Pedro Marques
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

‎README.md

Whitespace-only changes.

‎circuit/.gitkeep

Whitespace-only changes.

‎docs/.gitkeep

Whitespace-only changes.

‎src/.gitkeep

Whitespace-only changes.

‎src/robo/robo.ino

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Project Name: robo
3+
Authors:
4+
* Marino Hohenheim
5+
* Pedro Marques
6+
Version: 0.1.0
7+
Boards Supported:
8+
* Arduino UNO*
9+
Dependencies:
10+
Description:
11+
Descrição do projeto
12+
*/
13+
14+
#include <string.h>
15+
16+
#define MEM 50
17+
String msg;
18+
int mem[MEM];
19+
20+
void setup(){
21+
Serial.begin(9600);
22+
for(int i=0; i<MEM; i++)
23+
mem[i]=-1;
24+
/*
25+
Seta as coisa reservada
26+
*/
27+
}
28+
29+
int parse_msg(String msg);
30+
31+
void loop(){
32+
33+
if(Serial.available()){
34+
msg = String(Serial.readString());
35+
parse_msg(msg);
36+
}
37+
}
38+
39+
40+
int parse_msg(String msg){
41+
char c = msg[0];
42+
int p, value;
43+
44+
switch(c){
45+
case 'G':
46+
p = atoi(&msg[1]) -1;
47+
Serial.print("R");//Response prefix
48+
Serial.println(mem[p]);
49+
break;
50+
case 'S':
51+
p = atoi(&msg[1]) -1;
52+
value = atoi(&msg[msg.indexOf('=')+1]);
53+
mem[p] = value;
54+
Serial.print("R");//Response prefix
55+
Serial.println(mem[p]);
56+
break;
57+
case 'M':
58+
Serial.println(&msg[1]);
59+
break;
60+
default:
61+
break;
62+
}
63+
return 0;
64+
}

0 commit comments

Comments
 (0)
Please sign in to comment.