hexsha
stringlengths
40
40
size
int64
10
794k
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
220
max_stars_repo_name
stringlengths
6
117
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
6
max_stars_count
int64
1
14.7k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 01:20:43
2022-03-31 19:18:09
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-02 05:08:12
2022-03-31 23:57:55
max_issues_repo_path
stringlengths
5
220
max_issues_repo_name
stringlengths
6
117
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
6
max_issues_count
int64
1
3.42k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
220
max_forks_repo_name
stringlengths
6
117
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
6
max_forks_count
int64
0
5.94k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:55:08
2022-03-31 23:12:50
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-05 02:59:17
2022-03-31 23:12:50
content
stringlengths
10
794k
avg_line_length
float64
2.9
123
max_line_length
int64
9
497
alphanum_fraction
float64
0.29
0.95
retain
bool
1 class
num_tokens
int64
4
558k
ef737085a8a123fd9842299a4e69ecc6e6739bdb
214
ino
Arduino
examples/3.Advanced/ball/Set_UP.ino
FT81xMania/GD23ZU_FH
05406715ceccabc46849d8e21091f72501e6d313
[ "BSD-3-Clause" ]
1
2021-05-01T04:26:42.000Z
2021-05-01T04:26:42.000Z
examples/3.Advanced/ball/Set_UP.ino
FT81xMania/GD23ZU_FH
05406715ceccabc46849d8e21091f72501e6d313
[ "BSD-3-Clause" ]
null
null
null
examples/3.Advanced/ball/Set_UP.ino
FT81xMania/GD23ZU_FH
05406715ceccabc46849d8e21091f72501e6d313
[ "BSD-3-Clause" ]
1
2021-03-16T08:32:51.000Z
2021-03-16T08:32:51.000Z
void setup() { GD.begin(); //GD.cmd_setrotate(0); IDEMCU(); XMAX=GD.w; YMAX=GD.h; //GD.BitmapHandle(15); GD.cmd_loadimage(0, 0); GD.load("football.png"); //48 MP(); } void loop(){}
15.285714
32
0.53271
true
74
42d75118904fe2637f6bcbd95498cb760c50c0a7
48,612
ino
Arduino
IMAGEDISPLAY.ino
2brandonh/ideahacks
426d2ea613aff073714c62cd9d2b6124d7b88826
[ "Intel" ]
1
2020-01-27T00:43:09.000Z
2020-01-27T00:43:09.000Z
IMAGEDISPLAY.ino
Realises/ideahacks
426d2ea613aff073714c62cd9d2b6124d7b88826
[ "Intel" ]
null
null
null
IMAGEDISPLAY.ino
Realises/ideahacks
426d2ea613aff073714c62cd9d2b6124d7b88826
[ "Intel" ]
1
2020-08-29T04:12:25.000Z
2020-08-29T04:12:25.000Z
/********* Rui Santos Complete project details at https://randomnerdtutorials.com *********/ #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); static const uint8_t image_data_food[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xfe, 0x1f, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xf9, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xe7, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xcf, 0xdf, 0xbe, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0x9f, 0x9f, 0xbe, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xbf, 0x1f, 0x9f, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0x7f, 0x3f, 0x9f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3e, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x3f, 0xbf, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0x3f, 0xff, 0x01, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0xf8, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x3c, 0x1c, 0xe3, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x40, 0x40, 0x6f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x1f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xfe, 0x27, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0x00, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0x07, 0xfe, 0x40, 0x00, 0x3f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0x07, 0xfe, 0xff, 0xff, 0xf8, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xee, 0x3f, 0x87, 0xfe, 0x7f, 0xff, 0xe3, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xec, 0x1f, 0xdf, 0xce, 0x07, 0xff, 0x8f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe4, 0x1f, 0xff, 0x86, 0xf0, 0x7e, 0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0x1f, 0xff, 0x02, 0xff, 0x01, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf6, 0x3f, 0xff, 0x82, 0xff, 0xe7, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf8, 0x7f, 0x86, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf8, 0x3e, 0x7e, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf0, 0x3c, 0x1d, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xf8, 0x04, 0x1c, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfc, 0x80, 0x1c, 0x03, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0x0f, 0x82, 0x3d, 0xf0, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x0f, 0x83, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfa, 0x07, 0xc7, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0x0f, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x9f, 0xf3, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf9, 0xe1, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf0, 0xc0, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf0, 0x60, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x10, 0x60, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0xfe, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x02, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_study[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x86, 0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x31, 0xcd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x87, 0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xe7, 0xf2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xf7, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xf7, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xf3, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xfb, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfb, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfb, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xfb, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfb, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xf3, 0xfd, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xf3, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf7, 0xfc, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xf7, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x3f, 0xe7, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xcf, 0xef, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xe1, 0xcf, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x0c, 0x1f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0x9f, 0xbf, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xef, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xef, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xe7, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xf7, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xfe, 0x7f, 0xe0, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x3f, 0x8f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0x9e, 0x3f, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xdc, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x19, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x37, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xb3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_sleep[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcd, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3b, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x73, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xe7, 0xfe, 0x06, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xef, 0xf8, 0x1e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xcf, 0xf0, 0x7e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xdf, 0xfb, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xdf, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x9f, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xbf, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x3f, 0xff, 0xf1, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x7f, 0xff, 0xf3, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x7f, 0xff, 0xf3, 0xc0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0x7f, 0xff, 0xe3, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x7f, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x7f, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x3f, 0xff, 0xc7, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xbf, 0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0x9f, 0xff, 0xff, 0xfc, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0x9f, 0xff, 0x8f, 0xf8, 0x23, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xdf, 0xfe, 0x1f, 0xfd, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xcf, 0xf8, 0x1f, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xe7, 0xfc, 0x97, 0xff, 0xcf, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xf7, 0xff, 0x83, 0xff, 0xc8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xf3, 0xff, 0x03, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xf9, 0xff, 0x0f, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfc, 0xff, 0x3f, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xcf, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xe3, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xf8, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfe, 0x07, 0x80, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xf0, 0x0f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_guest[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x41, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0x65, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xfc, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0x9f, 0xf3, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xdf, 0xe7, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xcf, 0xef, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xef, 0xcf, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xef, 0xdf, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xe7, 0xdf, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xe7, 0x9f, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xf7, 0xbf, 0xfe, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff,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xe7, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x7c, 0x7f, 0x0f, 0x76, 0xe7, 0xff, 0xfb, 0xe7, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7c, 0x7f, 0x8f, 0x76, 0x67, 0x8f, 0xf1, 0xe7, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x7f, 0xff, 0xff, 0x67, 0x67, 0x0f, 0xf1, 0xe7, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x7f, 0xff, 0xff, 0x6f, 0x27, 0x9f, 0xfb, 0xe6, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0x7f, 0xff, 0xff, 0x4f, 0x97, 0xff, 0xff, 0xe4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x7f, 0xff, 0xff, 0x5f, 0xc7, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0x1e, 0x07, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0x3c, 0x67, 0xf8, 0x1f, 0xe7, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x9c, 0xff, 0x71, 0xe7, 0xf9, 0xdf, 0xe7, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x9c, 0xff, 0x77, 0xe7, 0xf9, 0x9f, 0xe7, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xdd, 0xff, 0x6f, 0xe7, 0xf9, 0x9f, 0xe7, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xcd, 0xfe, 0x4f, 0xf7, 0xfd, 0x9f, 0xe7, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xc9, 0xff, 0x5f, 0xe7, 0xfc, 0xbf, 0xe7, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe3, 0xfe, 0x1f, 0xe7, 0xfe, 0x3f, 0xe3, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xf3, 0xfe, 0x3f, 0xe7, 0xff, 0x7f, 0xe3, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xfe, 0x3f, 0xcb, 0xff, 0xff, 0xc9, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfe, 0x3f, 0xdb, 0xff, 0xff, 0xdc, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfc, 0xbf, 0x9b, 0xff, 0xff, 0xde, 0x7f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfd, 0x3f, 0x39, 0xff, 0xff, 0x9f, 0x0f, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xf9, 0x3c, 0x7c, 0xff, 0xff, 0x3f, 0xc1, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xfb, 0x61, 0xfe, 0x7f, 0xff, 0x7f, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xe7, 0x0f, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xcf, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_privacy[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xfe, 0x3f, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xfc, 0x0f, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xf8, 0x0f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xf0, 0x07, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf0, 0x07, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf0, 0x07, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf0, 0x07, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xf8, 0x0f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xfc, 0x1f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0x7f, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_school[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0x4f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa7, 0x2f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0x5f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0xff, 0x5f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0xfe, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xf8, 0x7f, 0xfc, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xff, 0xf0, 0x7f, 0xfd, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdc, 0xff, 0xf0, 0x7f, 0xfb, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xde, 0x7f, 0xf0, 0x7f, 0xe7, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x9f, 0xfd, 0xff, 0xcf, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xc7, 0xff, 0xfe, 0x3f, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xf0, 0x1f, 0x80, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x80, 0x1f, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xf8, 0x00, 0x00, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xe3, 0xff, 0xfe, 0x3f, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xcf, 0xff, 0xff, 0xdf, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xdf, 0xff, 0xff, 0xcf, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x9f, 0xff, 0xff, 0xef, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0x9f, 0xff, 0xff, 0xef, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x9f, 0xff, 0xff, 0xef, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x9f, 0xff, 0xff, 0xef, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x9f, 0xff, 0xff, 0xef, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x9f, 0xff, 0xff, 0xef, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xdf, 0xff, 0xff, 0xce, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xcf, 0xff, 0xff, 0x9e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xe1, 0xff, 0xfc, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xfc, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static const uint8_t image_data_party[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xe0, 0x0f, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xfc, 0xe0, 0x1c, 0x3f, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf9, 0xe0, 0x0f, 0x9f, 0xe0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xf7, 0xe0, 0x0f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xfe, 0x20, 0x00, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x01, 0xfb, 0xc0, 0x0f, 0x7f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x01, 0xf8, 0x60, 0x11, 0xbe, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x70, 0x30, 0x00, 0xbc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x70, 0x30, 0x00, 0xf8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0x70, 0x11, 0xb0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x1a, 0xe0, 0x0b, 0xa0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0d, 0xc3, 0x86, 0x60, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xe7, 0xcf, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x07, 0xe6, 0x8f, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xe3, 0x8f, 0x80, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xe3, 0x1f, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x01, 0xe3, 0x1e, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0xf0, 0x1e, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x70, 0x3c, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x70, 0x18, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x30, 0x38, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xe0, 0x30, 0x30, 0x1f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xf8, 0x18, 0x30, 0x3d, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x1c, 0x08, 0x20, 0x70, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x07, 0x08, 0x61, 0xc0, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x01, 0x8c, 0x43, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x44, 0x44, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x24, 0x90, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd2, 0x00, 0x00, 0xb7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0e, 0xc0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0e, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x3e, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7e, 0xfc, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xfe, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; void setup() { Serial.begin(115200); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); } //test run for all images //food delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("food"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_food, 128, 64, 1); display.display(); //study delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("study"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_study, 128, 64, 1); display.display(); //sleep delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("sleep"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_sleep, 128, 64, 1); display.display(); //guest delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("guest"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_guest, 128, 64, 1); display.display(); //privacy delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("privacy"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_privacy, 128, 64, 1); display.display(); //school delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("school"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_school, 128, 64, 1); display.display(); //party delay(2000); display.clearDisplay(); display.setCursor(0,0); display.setTextColor(WHITE); display.setTextSize(3); display.print("party"); display.display(); delay(2000); display.clearDisplay(); display.invertDisplay(true); display.drawBitmap(0, 0, image_data_party, 128, 64, 1); display.display(); } void loop() { }
81.563758
100
0.638423
true
31,964
97420f90fbd57b7b73d049a6acc106c7ef612161
1,096
ino
Arduino
src/test_dcmotor_speed/test_dcmotor_speed.ino
akafael/spider-rccar
b19714e9e056b320026eca384ba2bc6faa474635
[ "MIT" ]
null
null
null
src/test_dcmotor_speed/test_dcmotor_speed.ino
akafael/spider-rccar
b19714e9e056b320026eca384ba2bc6faa474635
[ "MIT" ]
null
null
null
src/test_dcmotor_speed/test_dcmotor_speed.ino
akafael/spider-rccar
b19714e9e056b320026eca384ba2bc6faa474635
[ "MIT" ]
0
null
null
#include <elapsedMillis.h> #define PINLED 13 #define PINMOTOR_EN 9 #define PINMOTOR1 6 #define PINMOTOR2 5 #define MAX_SPEED 100 #define SPEED_ACC 500 elapsedMillis timerLoop; const int timeStep = 100; // ms elapsedMillis timerGlobal; int speedMotor,speedStep; void setup() { Serial.begin(9600); pinMode(PINLED, OUTPUT); pinMode(PINMOTOR1, OUTPUT); pinMode(PINMOTOR2, OUTPUT); pinMode(PINMOTOR_EN, OUTPUT); digitalWrite(PINMOTOR_EN,HIGH); analogWrite(PINMOTOR1,0); analogWrite(PINMOTOR2,0); speedStep = 1; timerGlobal = 0; } void loop() { if( timerLoop >= timeStep ) // Control Frequency time { // Reset Timer timerLoop = 0; speedStep = (speedMotor >=MAX_SPEED)?-1:(speedMotor < -MAX_SPEED) ?1:speedStep; speedMotor +=speedStep; if( speedMotor > 0 ) { analogWrite(PINMOTOR1,speedMotor); analogWrite(PINMOTOR2,0); } else { analogWrite(PINMOTOR1,0); analogWrite(PINMOTOR2,10-speedMotor ); } // Serial.print(timerGlobal); Serial.print(";"); Serial.println(speedMotor); } }
17.396825
83
0.668796
true
331
bcfe318ad4f03e84f639c60d317e2301fc6cc9e5
1,062
ino
Arduino
2017 Robot/src/org/usfirst/frc/team4634/robot/rangefinder-arduino.ino/rangefinder-arduino.ino.ino
Wolfbotz-4634/wolfbotz-code
1545e6ae6ae80408099bda0e04d898e2fc2e0b8f
[ "Apache-2.0" ]
null
null
null
2017 Robot/src/org/usfirst/frc/team4634/robot/rangefinder-arduino.ino/rangefinder-arduino.ino.ino
Wolfbotz-4634/wolfbotz-code
1545e6ae6ae80408099bda0e04d898e2fc2e0b8f
[ "Apache-2.0" ]
null
null
null
2017 Robot/src/org/usfirst/frc/team4634/robot/rangefinder-arduino.ino/rangefinder-arduino.ino.ino
Wolfbotz-4634/wolfbotz-code
1545e6ae6ae80408099bda0e04d898e2fc2e0b8f
[ "Apache-2.0" ]
0
null
null
/***************************************************************************/ // Function: Measure the distance to obstacles in front and display the // result on seeedstudio serialLcd. Make sure you installed the // serialLCD, SoftwareSerial and Ultrasonic library. // Hardware: Grove - Ultrasonic Ranger, Grove - Serial LCD // Arduino IDE: Arduino-1.0 // Author: LG // Date: Jan 17,2013 // Version: v1.0 modified by FrankieChu // by www.seeedstudio.com /*****************************************************************************/ #include <SoftwareSerial.h> #include "Ultrasonic.h" Ultrasonic ultrasonic(7); #define trigPin 13 #define echoPin 10 void setup() { Serial.begin (9600); } void loop() { long RangeInCentimeters; RangeInCentimeters = ultrasonic.MeasureInCentimeters(); delay(150); Serial.print("The distance:"); Serial.print(RangeInCentimeters,DEC); Serial.write(RangeInCentimeters); Serial.print("cm"); }
31.235294
87
0.546139
true
225
a144236247190d0e2558d63dc72b759244c8829a
3,083
ino
Arduino
Deprecated_fw/sketches/WHID_and_Cactus_micro_rev2_sketches/Arduino_Sketch/Arduino_Sketch.ino
minkione/WHID
a7cc46f992af38d3417cbfb79117a8cd69adc8a1
[ "MIT" ]
1
2018-12-10T10:02:22.000Z
2018-12-10T10:02:22.000Z
Deprecated_fw/sketches/WHID_and_Cactus_micro_rev2_sketches/Arduino_Sketch/Arduino_Sketch.ino
minkione/WHID
a7cc46f992af38d3417cbfb79117a8cd69adc8a1
[ "MIT" ]
null
null
null
Deprecated_fw/sketches/WHID_and_Cactus_micro_rev2_sketches/Arduino_Sketch/Arduino_Sketch.ino
minkione/WHID
a7cc46f992af38d3417cbfb79117a8cd69adc8a1
[ "MIT" ]
0
null
null
/* * ################################################ * #### DEPRECATED FW! Please use ESPloitV2!!! #### * ################################################ * WHID Injector - Arduino Sketch * http://whid.ninja * Forked by Luca Bongiorni * Based on ESPloit by Corey Harding of www.LegacySecurityGroup.com */ /* For individual keypresses or combinations of key presses send the following via software serial: -"Press:X" or "Press:X+Y" or "Press:X+Y+Z" and so forth --Expects DECIMAL Values for X,Y,Z,etc --Sending the following via software serial "Press:131+114" with the Arduino's USB plugged into a Windows machine would output KEY_LEFT_GUI(Windows_Key)+r thus launching the run prompt --List of modifier keys(GUI,ALT,CTRL,ETC) at https://www.arduino.cc/en/Reference/KeyboardModifiers --ASCII table lookup at http://www.asciitable.com/ To type out strings of text send via software serial: -"Print:XYZ" Types out "XYZ" --Sending the following via software serial "Print:www.Exploit.Agency" would type out "www.Exploit.Agency" on the machine connected via USB To type out strings of text send via software serial: -"PrintLine:XYZ" Types out "XYZ" then presses enter --Sending the following via software serial "PrintLine:www.Exploit.Agency" would type out "www.Exploit.Agency" on the machine connected via USB and press enter To make a delay: -"Delay" --Sending the following via software serial "Delay" would wait for X seconds(length of delay set in esp8266 sketch) on the machine connected via USB before proceeding to next item in payload */ #include <Keyboard.h> #include <SoftwareSerial.h> //#include <HID-Project.h> //#include <HID-Settings.h> //Used later for determining if we are ready to release a key press or a combination of key presses int keypressdone=0; void setup() { pinMode(13, OUTPUT); digitalWrite(13,HIGH); Serial1.begin(4800); Keyboard.begin(); } void loop() { while (Serial1.available()) { String cmd = Serial1.readStringUntil(':'); //If command equals "Press:X" or "Press:X+Y+ETC" if(cmd == "Press"){ keypressdone=1; String fullkeys = Serial1.readString(); int str_len = fullkeys.length()+1; char keyarray[str_len]; fullkeys.toCharArray(keyarray, str_len); char delimiter[] = "+"; char *keypart; keypart = strtok(keyarray, delimiter); while(keypart != NULL) { int key = atoi(keypart); delay(25); Keyboard.press(key); keypart = strtok(NULL, delimiter); } if(keypressdone==1) { delay(25); Keyboard.releaseAll(); keypressdone=0; } } //If command equals "Print:X" else if(cmd == "Print") { String keycode = Serial1.readString(); delay(25); Keyboard.print(keycode); } //If command equals "PrintLine:X" else if(cmd == "PrintLine") { String keycode = Serial1.readString(); delay(25); Keyboard.print(keycode); delay(25); Keyboard.press(KEY_RETURN); delay(25); Keyboard.release(KEY_RETURN); } } }
33.150538
190
0.655855
true
749
d50e75991d4b443492ad74c90a8316f5b370bb20
319
ino
Arduino
ejercicio/_26-motor-servo/_26-motor-servo.ino
MaraniMatias/curso-Arduino
75e17affe629a96630dea3c6209d3830bd0cc337
[ "MIT" ]
null
null
null
ejercicio/_26-motor-servo/_26-motor-servo.ino
MaraniMatias/curso-Arduino
75e17affe629a96630dea3c6209d3830bd0cc337
[ "MIT" ]
null
null
null
ejercicio/_26-motor-servo/_26-motor-servo.ino
MaraniMatias/curso-Arduino
75e17affe629a96630dea3c6209d3830bd0cc337
[ "MIT" ]
0
null
null
#include <Servo.h> Servo myservo; int pos = 0; void setup() { myservo.attach(12); } void loop() { for (pos = 0; pos <= 180; pos += 1) { // desde 0 a 180 grados myservo.write(pos); delay(10); } for (pos = 180; pos >= 0; pos -= 1) { // desde 180 a 0 grados myservo.write(pos); delay(10); } }
15.95
63
0.545455
true
119
8867dd1a46aa6e0ad2178ed6208f90c58b58abf2
11,983
ino
Arduino
Main.ino
georgeuy2/Ferrofluid-Display
6b79eb5cbb94c2f02a19cabc0cea632624bd76c1
[ "Apache-2.0" ]
null
null
null
Main.ino
georgeuy2/Ferrofluid-Display
6b79eb5cbb94c2f02a19cabc0cea632624bd76c1
[ "Apache-2.0" ]
null
null
null
Main.ino
georgeuy2/Ferrofluid-Display
6b79eb5cbb94c2f02a19cabc0cea632624bd76c1
[ "Apache-2.0" ]
0
null
null
/* CS179J Senior Project * Created and designed by: George Uy de Ong II * * Ferrofluid Display * * Parts: * (5) Nema 17 stepper motors * (5) Stepper motor drivers * (5) 24V solenoid * (25) Round shape neodymium magnets * (1) Ferrofluid bottle 250ml * (1) Power Supply * */ #include "StepperMotor.h" #include <Nextion.h> // Stepper Motor 1 #define but_pin1 2 //32 // Limit switch #define rot_pin1 55 //43 // CW = clockwise and CCW = counterclockwise #define en_pin1 38 //23 // Turn on or off motor #define step_pin1 54 //33 // Steps #define sold_pin1 22 // Turn on or off of solenoid // Stepper Motor 2 #define but_pin2 19 //34 #define rot_pin2 48 //47 #define en_pin2 62 //27 #define step_pin2 46 //37 #define sold_pin2 26 // Stepper Motor 3 #define but_pin3 18 //36 #define rot_pin3 61 //45 #define en_pin3 56 //25 #define step_pin3 60 //35 #define sold_pin3 24 // Stepper Motor 4 #define but_pin4 15 //38 #define rot_pin4 28 //49 #define en_pin4 24 //29 #define step_pin4 26 //39 #define sold_pin4 28 // Stepper Motor 5 #define but_pin5 14 //40 #define rot_pin5 34 //51 #define en_pin5 30 //31 #define step_pin5 36 //41 #define sold_pin5 30 // Stepper Motors StepperMotor stepMotor1(step_pin1, rot_pin1, en_pin1, sold_pin1, but_pin1); StepperMotor stepMotor2(step_pin2, rot_pin2, en_pin2, sold_pin2, but_pin2); StepperMotor stepMotor3(step_pin3, rot_pin3, en_pin3, sold_pin3, but_pin3); StepperMotor stepMotor4(step_pin4, rot_pin4, en_pin4, sold_pin4, but_pin4); StepperMotor stepMotor5(step_pin5, rot_pin5, en_pin5, sold_pin5, but_pin5); // Cell Buttons NexButton b0 = NexButton(0, 1, "b0"); NexButton b1 = NexButton(0, 2, "b1"); NexButton b2 = NexButton(0, 3, "b2"); NexButton b3 = NexButton(0, 4, "b3"); NexButton b4 = NexButton(0, 5, "b4"); NexButton b5 = NexButton(0, 6, "b5"); NexButton b6 = NexButton(0, 7, "b6"); NexButton b7 = NexButton(0, 8, "b7"); NexButton b8 = NexButton(0, 9, "b8"); NexButton b9 = NexButton(0, 10, "b9"); NexButton b10 = NexButton(0, 11, "b10"); NexButton b11 = NexButton(0, 12, "b11"); NexButton b12 = NexButton(0, 13, "b12"); NexButton b13 = NexButton(0, 14, "b13"); NexButton b14 = NexButton(0, 15, "b14"); NexButton b15 = NexButton(0, 16, "b15"); NexButton b16 = NexButton(0, 17, "b16"); NexButton b17 = NexButton(0, 18, "b17"); NexButton b18 = NexButton(0, 19, "b18"); NexButton b19 = NexButton(0, 20, "b19"); NexButton b20 = NexButton(0, 21, "b20"); NexButton b21 = NexButton(0, 22, "b21"); NexButton b22 = NexButton(0, 23, "b22"); NexButton b23 = NexButton(0, 24, "b23"); NexButton b24 = NexButton(0, 25, "b24"); NexButton b25 = NexButton(0, 26, "b25"); // Draw button // Cell booealns boolean c[25]; void setAllCellsToFalse(){ for(byte i = 0; i<25; i++){ c[i] = false; } } // NexTouch *nex_listen_list[] = { &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &b9, &b10, &b11, &b12, &b13, &b14, &b15, &b16, &b17, &b18, &b19, &b20, &b21, &b22, &b23, &b24, &b25, NULL }; void b0ButtonPress( void *ptr ){ c[0] = !c[0]; Serial.println(c[0]); } void b1ButtonPress( void *ptr ){ c[1] = !c[1]; Serial.println(c[1]); } void b2ButtonPress( void *ptr ){ c[2] = !c[2]; Serial.println(c[2]); } void b3ButtonPress( void *ptr ){ c[3] = !c[3]; Serial.println(c[3]); } void b4ButtonPress( void *ptr ){ c[4] = !c[4]; Serial.println(c[4]); } void b5ButtonPress( void *ptr ){ c[5] = !c[5]; Serial.println(c[5]); } void b6ButtonPress( void *ptr ){ c[6] = !c[6]; Serial.println(c[6]); } void b7ButtonPress( void *ptr ){ c[7] = !c[7]; Serial.println(c[7]); } void b8ButtonPress( void *ptr ){ c[8] = !c[8]; Serial.println(c[8]); } void b9ButtonPress( void *ptr ){ c[9] = !c[9]; Serial.println(c[9]); } void b10ButtonPress( void *ptr ){ c[10] = !c[10]; Serial.println(c[10]); } void b11ButtonPress( void *ptr ){ c[11] = !c[11]; Serial.println(c[11]); } void b12ButtonPress( void *ptr ){ c[12] = !c[12]; Serial.println(c[12]); } void b13ButtonPress( void *ptr ){ c[13] = !c[13]; Serial.println(c[13]); } void b14ButtonPress( void *ptr ){ c[14] = !c[14]; Serial.println(c[14]); } void b15ButtonPress( void *ptr ){ c[15] = !c[15]; Serial.println(c[15]); } void b16ButtonPress( void *ptr ){ c[16] = !c[16]; Serial.println(c[16]); } void b17ButtonPress( void *ptr ){ c[17] = !c[17]; Serial.println(c[17]); } void b18ButtonPress( void *ptr ){ c[18] = !c[18]; Serial.println(c[18]); } void b19ButtonPress( void *ptr ){ c[19] = !c[19]; Serial.println(c[19]); } void b20ButtonPress( void *ptr ){ c[20] = !c[20]; Serial.println(c[20]); } void b21ButtonPress( void *ptr ){ c[21] = !c[21]; Serial.println(c[21]); } void b22ButtonPress( void *ptr ){ c[22] = !c[22]; Serial.println(c[22]); } void b23ButtonPress( void *ptr ){ c[23] = !c[23]; Serial.println(c[23]); } void b24ButtonPress( void *ptr ){ c[24] = !c[24]; Serial.println(c[24]); } boolean drawButtonState; void drawButtonPress( void *ptr){ drawButtonState = true; bottomToTopOrder(); stepMotor1.setCells( c[0], c[1], c[2], c[3], c[4] ); // for(int i = 0; i<5; i++){ // Serial.print(c[i]); // Serial.print(" ,"); // } // Serial.println(); stepMotor2.setCells( c[5], c[6], c[7], c[8], c[9] ); stepMotor3.setCells( c[10], c[11], c[12], c[13], c[14] ); stepMotor4.setCells( c[15], c[16], c[17], c[18], c[19] ); stepMotor5.setCells( c[20], c[21], c[22], c[23], c[24] ); Serial.println("Draw button Pressed"); } void bottomToTopOrder(){ int MAX_HEIGHT = 0; for(int i=4; i>0; i--){ // Serial.println(i+1); if(isAnyElementOfRowTrue(i) == true){ Serial.println(i); MAX_HEIGHT = i; break; } } /* for( int j = 0; j < MAX_HEIGHT; j++){ } */ } /* x is the Row starting from 0 to 5. Since I am using a 5X4 * */ boolean isAnyElementOfRowTrue(int x){ boolean row = false; int i = 0; int endOfArray = 0; if(x == 4){ i = 5; endOfArray = 10; } else if( x ==3){ i = 10; endOfArray = 14; } else if( x ==2){ i = 15; endOfArray = 20; } else if( x ==1){ i = 20; endOfArray = 25; } else{ Serial.println("Error getting true row"); } for( ; i<endOfArray; i++){ if( c[i] == true){ row = true; Serial.print(i); Serial.print(" "); break; } } return row; } void initAllButtons(){ b0.attachPush(b0ButtonPress); b1.attachPush(b1ButtonPress); b2.attachPush(b2ButtonPress); b3.attachPush(b3ButtonPress); b4.attachPush(b4ButtonPress); b5.attachPush(b5ButtonPress); b6.attachPush(b6ButtonPress); b7.attachPush(b7ButtonPress); b8.attachPush(b8ButtonPress); b9.attachPush(b9ButtonPress); b10.attachPush(b10ButtonPress); b11.attachPush(b11ButtonPress); b12.attachPush(b12ButtonPress); b13.attachPush(b13ButtonPress); b14.attachPush(b14ButtonPress); b15.attachPush(b15ButtonPress); b16.attachPush(b16ButtonPress); b17.attachPush(b17ButtonPress); b18.attachPush(b18ButtonPress); b19.attachPush(b19ButtonPress); b20.attachPush(b20ButtonPress); b21.attachPush(b21ButtonPress); b22.attachPush(b22ButtonPress); b23.attachPush(b23ButtonPress); b24.attachPush(b24ButtonPress); b25.attachPush(drawButtonPress); } // Variables int input; boolean receivedInput; boolean allMotorsAtOrigin; // State enum State{ Start_State, Wait_State, Move_State} state; // Setup void setup(){ nexInit(); Serial.begin(9600); receivedInput = false; input = 0; allMotorsAtOrigin = false; drawButtonState = false; setAllCellsToFalse(); initAllButtons(); state = Start_State; dbSerialPrintln("Setup Done"); } void allMotorsGoToOrigin(){ // if( !(stepMotor1.isAtOrigin()) ){ // stepMotor1.gotoOrigin(); // } if( !(stepMotor2.isAtOrigin()) ){ stepMotor2.gotoOrigin(); } if( !(stepMotor3.isAtOrigin()) ){ stepMotor3.gotoOrigin(); } // if( !(stepMotor4.isAtOrigin()) ){ // stepMotor4.gotoOrigin(); // } if( !(stepMotor5.isAtOrigin()) ){ stepMotor5.gotoOrigin(); } // if( stepMotor1.isAtOrigin() && stepMotor2.isAtOrigin() && stepMotor3.isAtOrigin() && stepMotor4.isAtOrigin() && stepMotor5.isAtOrigin() ){ // allMotorsAtOrigin = true; // } if (stepMotor2.isAtOrigin() == true && stepMotor3.isAtOrigin() ==true && stepMotor5.isAtOrigin() == true){ allMotorsAtOrigin = true; } } boolean isAnyOfTheMotorsDone(){ boolean motorsDone; // if( stepMotor1.isDone() == true && stepMotor2.isDone() == true && stepMotor3.isDone() == true && stepMotor4.isDone() == true && stepMotor5.isDone() == true){ // if( stepMotor4.isDone() == true){ // Serial.println("true"); // } // else{ // Serial.println("false"); // } if(stepMotor2.isDone() == true && stepMotor3.isDone() == true && stepMotor5.isDone() == true){ motorsDone = true; } else{ motorsDone = false; } return motorsDone; } boolean isAnyOfTheMotorsMoving(){ boolean motorsMoving; // if( stepMotor1.isMoving() || stepMotor2.isMoving() || stepMotor3.isMoving() || stepMotor4.isMoving() || stepMotor5.isMoving() ){ if( stepMotor2.isMoving() == true || stepMotor3.isMoving() == true || stepMotor5.isMoving() == true ){ motorsMoving = true; } else{ motorsMoving = false; } return motorsMoving; } boolean isAllMotorsAtOrigin(){ return allMotorsAtOrigin; } void setAllMotorsAtOrigin(boolean b){ allMotorsAtOrigin = b; } int ferroFluidDisplay(int state){ switch(state){ case Start_State: //Serial.println("@ Start State"); if( !isAllMotorsAtOrigin() ){ allMotorsGoToOrigin(); } else{ state = Wait_State; //input = 0; // make sure no user put any input before goign to wait state } break; case Wait_State: //Serial.println("@ Wait State"); if(drawButtonState == false){ state = Wait_State; } else if( (drawButtonState == true) && !isAnyOfTheMotorsMoving() && isAllMotorsAtOrigin()){ // Serial.println("@ 2 State"); state = Move_State; setAllMotorsAtOrigin(false); stepMotor2.restartCellStateMachine(); stepMotor3.restartCellStateMachine(); // stepMotor4.restartCellStateMachine(); stepMotor5.restartCellStateMachine(); } break; case Move_State: // Serial.println("@ Move"); if( (drawButtonState == true) && !isAllMotorsAtOrigin()){ state = Move_State; // Serial.println("@go"); // stepMotor1.goToCellsStateMachine(); stepMotor2.goToCellsStateMachine(); stepMotor3.goToCellsStateMachine(); // stepMotor4.goToCellsStateMachine(); stepMotor5.goToCellsStateMachine(); // if stepper finishes going to all cells then set receiveInputState = false if(isAnyOfTheMotorsDone() == true){ Serial.println("@@@@@@@@@@@@@@@@@@@@@@@@"); drawButtonState = false; } } else if( (drawButtonState == false) && isAnyOfTheMotorsDone() && !isAllMotorsAtOrigin()){ state = Start_State; Serial.println("-----------------------"); } break; default: state = Start_State; break; } //Serial.println(state); return state; } void loop(){ nexLoop(nex_listen_list); state = ferroFluidDisplay(state); }
23.823062
162
0.594425
true
3,890
17e462a390ea6463294edfee680661be98ceed3d
3,099
ino
Arduino
examples/deepsleep/button_hold_wakeup/button_hold_wakeup.ino
winocc/snooze
e62da81df2c713888f1548f0aa61318449764e72
[ "MIT" ]
null
null
null
examples/deepsleep/button_hold_wakeup/button_hold_wakeup.ino
winocc/snooze
e62da81df2c713888f1548f0aa61318449764e72
[ "MIT" ]
null
null
null
examples/deepsleep/button_hold_wakeup/button_hold_wakeup.ino
winocc/snooze
e62da81df2c713888f1548f0aa61318449764e72
[ "MIT" ]
0
null
null
/************************************************* This example is used when you want to simulate a button being held for certian amount of time before waking your Teensy from deepSleep sleep. This example uses the Bounce library to make sure the button is still pressed for 3 seconds after waking up from low power mode. If it released before the 3 seconds are up, go back to sleep. *************************************************/ #include <Snooze.h> #include <Bounce.h> // Load drivers SnoozeDigital digital;// this is the pin wakeup driver // use bounce for pin 2, debounce of 5ms Bounce button = Bounce(2, 5); // install driver into SnoozeBlock SnoozeBlock config(digital);// digital driver is now a wakeup void setup() { // Configure pin 2 for bounce library pinMode(2, INPUT_PULLUP); // debug led pinMode(LED_BUILTIN, OUTPUT); while (!Serial); delay(100); Serial.println("start..."); delay(20); //pin, mode, type digital.pinMode(2, INPUT_PULLUP, FALLING); } void loop() { // if not held for 3 sec go back here to sleep. SLEEP: // you need to update before sleeping. button.update(); // returns module that woke processor after waking from low power mode. Snooze.deepSleep( config ); // indicate the button woke it up, hold led high for as long as the button // is held down. digitalWrite(LED_BUILTIN, HIGH); elapsedMillis timeout = 0; // bounce needs to call update longer than the debounce time = 5ms, // which is set in constructor. while (timeout < 6) button.update(); // now check for 3 second button hold bool awake = threeSecondHold(); // if not held for 3 seconds go back to sleep if (!awake) goto SLEEP; // the button was held for at least 3 seconds if // you get here do some stuff for 7 seconds then // go to sleep. elapsedMillis time = 0; while (1) { unsigned int t = time; Serial.printf("doin stuff for: %i milliseconds\n", t); // back to sleep after 7 seconds if (time > 7000) { Serial.println("sleeping now :)"); // little delay so serial can finish sending delay(5); goto SLEEP; } digitalWrite(LED_BUILTIN, HIGH); delay(50); digitalWrite(LED_BUILTIN, LOW); delay(50); } } bool threeSecondHold() { // this is the 3 sec button press check while (button.duration() < 3000) { // get the current pin state, must have this! button.update(); // check the pin 2 state, if button not // pressed before 3 seconds go back to // sleep. We read 0 since pin 2 is // configured as INPUT_PULLUP. if (button.read() != 0) { digitalWrite(LED_BUILTIN, LOW); // let go of button before 3 sec up return false; } } digitalWrite(LED_BUILTIN, LOW); // button was held for 3 seconds so now we are awake return true; }
28.431193
78
0.593417
true
742
5526930ac4b84848e71ac221a91d0be12be3f265
8,133
ino
Arduino
Arduino Libraries/Adafruit_BluefruitLE_nRF51-master/examples/hidmouse/hidmouse.ino
Olivinitic/Environment-Monitor
34fbaddce5d126b1aa9559dbb14e717c9ab4e986
[ "MIT" ]
1
2016-06-22T04:31:25.000Z
2016-06-22T04:31:25.000Z
Adafruit_BluefruitLE_nRF51-master/examples/hidmouse/hidmouse.ino
Olivinitic/Garden_Project_Libraries
b868bb7d7dab56a7fbfa7b684711f9ab9ea2b858
[ "MIT" ]
null
null
null
Adafruit_BluefruitLE_nRF51-master/examples/hidmouse/hidmouse.ino
Olivinitic/Garden_Project_Libraries
b868bb7d7dab56a7fbfa7b684711f9ab9ea2b858
[ "MIT" ]
0
null
null
/********************************************************************* This is an example for our nRF51822 based Bluefruit LE modules Pick one up today in the adafruit shop! Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! MIT license, check LICENSE for more information All text above, and the splash screen below must be included in any redistribution *********************************************************************/ /* This example shows how to send HID (keyboard/mouse/etc) data via BLE Note that not all devices support BLE Mouse! - OSX, Windows 10 both work - Android has limited support - iOS completely ignores mouse */ #include <Arduino.h> #include <SPI.h> #if not defined (_VARIANT_ARDUINO_DUE_X_) && not defined(ARDUINO_ARCH_SAMD) #include <SoftwareSerial.h> #endif #include "Adafruit_BLE.h" #include "Adafruit_BluefruitLE_SPI.h" #include "Adafruit_BluefruitLE_UART.h" #include "BluefruitConfig.h" /*========================================================================= APPLICATION SETTINGS     FACTORYRESET_ENABLE    Perform a factory reset when running this sketch         Enabling this will put your Bluefruit LE module in a 'known good' state and clear any config data set in previous sketches or projects, so     running this at least once is a good idea.         When deploying your project, however, you will want to disable factory reset by setting this value to 0.  If you are making changes to your     Bluefruit LE device via AT commands, and those changes aren't persisting across resets, this is the reason why.  Factory reset will erase the non-volatile memory where config data is stored, setting it back to factory default values.             Some sketches that require you to bond to a central device (HID mouse, keyboard, etc.) won't work at all with this feature enabled since the factory reset will clear all of the bonding data stored on the chip, meaning the central device won't be able to reconnect. MINIMUM_FIRMWARE_VERSION Minimum firmware version to have some new features -----------------------------------------------------------------------*/ #define FACTORYRESET_ENABLE 0 #define MINIMUM_FIRMWARE_VERSION "0.6.6" /*=========================================================================*/ // Create the bluefruit object, either software serial...uncomment these lines /* SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN); Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN, BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN); */ /* ...or hardware serial, which does not need the RTS/CTS pins. Uncomment this line */ // Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN); /* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */ Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST); /* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */ //Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO, // BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS, // BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST); // A small helper void error(const __FlashStringHelper*err) { Serial.println(err); while (1); } /**************************************************************************/ /*! @brief Sets up the HW an the BLE module (this function is called automatically on startup) */ /**************************************************************************/ void setup(void) { while (!Serial); // required for Flora & Micro delay(500); Serial.begin(115200); Serial.println(F("Adafruit Bluefruit HID Mouse Example")); Serial.println(F("---------------------------------------")); /* Initialise the module */ Serial.print(F("Initialising the Bluefruit LE module: ")); if ( !ble.begin(VERBOSE_MODE) ) { error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?")); } Serial.println( F("OK!") ); if ( FACTORYRESET_ENABLE ) { /* Perform a factory reset to make sure everything is in a known state */ Serial.println(F("Performing a factory reset: ")); if ( ! ble.factoryReset() ){ error(F("Couldn't factory reset")); } } /* Disable command echo from Bluefruit */ ble.echo(false); Serial.println("Requesting Bluefruit info:"); /* Print Bluefruit information */ ble.info(); // This demo only available for firmware from 0.6.6 if ( !ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) ) { error(F("This sketch requires firmware version " MINIMUM_FIRMWARE_VERSION " or higher!")); } /* Enable HID Service (including Mouse) */ Serial.println(F("Enable HID Service (including Mouse): ")); if (! ble.sendCommandCheckOK(F( "AT+BleHIDEn=On" ))) { error(F("Failed to enable HID (firmware >=0.6.6?)")); } /* Add or remove service requires a reset */ Serial.println(F("Performing a SW reset (service changes require a reset): ")); if (! ble.reset() ) { error(F("Could not reset??")); } Serial.println(); Serial.println(F("Go to your phone's Bluetooth settings to pair your device")); Serial.println(F("then open an application that accepts mouse input")); Serial.println(); Serial.println(F("The example will try to draw a rectangle using the left mouse button with your input")); Serial.println(F("Parameters are a pair of 8-bit signed numbers (x,y) e.g:")); Serial.println(F(" 100,100 : draw toward bottom right corner")); Serial.println(F(" -100,-100: draw toward top left corner")); Serial.println(); } /**************************************************************************/ /*! @brief Constantly poll for new command or response data */ /**************************************************************************/ void loop(void) { Serial.println(F("x,y = ")); // Check for user input and echo it back if anything was found char input[BUFSIZE+1]; getUserInput(input, BUFSIZE); Serial.println(input); // Press (and hold) the Left mouse's button if ( ble.sendCommandCheckOK(F("AT+BleHidMouseButton=L,press")) ) { // delay a bit delay(250); // Mouse moves according to the user's input ble.print(F("AT+BleHidMouseMove=")); ble.println(input); if( ble.waitForOK() ) { Serial.println( F("OK!") ); }else { Serial.println( F("FAILED!") ); } // Way for user to release left button Serial.println( F("Enter anything to release Left Button") ); getUserInput(input, BUFSIZE); // Release the Left mouse's button ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0")); }else { // Failed, probably pairing is not complete yet Serial.println( F("Please make sure Bluefruit is paired and try again") ); } } /**************************************************************************/ /*! @brief Checks for user input (via the Serial Monitor) */ /**************************************************************************/ void getUserInput(char buffer[], uint8_t maxSize) { memset(buffer, 0, maxSize); while( Serial.available() == 0 ) { delay(1); } uint8_t count=0; do { count += Serial.readBytes(buffer+count, maxSize); delay(2); } while( (count < maxSize) && !(Serial.available() == 0) ); }
35.36087
108
0.577647
true
1,753
271aa3dd008a8949180f3cca92cffa512c9dd42e
3,268
ino
Arduino
sd-card-tester.ino
CyberPuck/SD-Card-Tester
fbad6dd10fa2bd311481e154f44e4c0a212caff5
[ "MIT" ]
null
null
null
sd-card-tester.ino
CyberPuck/SD-Card-Tester
fbad6dd10fa2bd311481e154f44e4c0a212caff5
[ "MIT" ]
null
null
null
sd-card-tester.ino
CyberPuck/SD-Card-Tester
fbad6dd10fa2bd311481e154f44e4c0a212caff5
[ "MIT" ]
0
null
null
/** * Simple test for the SD Card using an Arduino Uno R2. * This will do three things: * 1. Connect to card * 2. Get card type * 3. Check the volume size * */ #include<SPI.h> #include<SD.h> // Globals, primarly PIN setup const int CS_PIN = 8; const int CD_PIN = 9; // Primary SD Card object Sd2Card card; // SD Card volume object SdVolume volume; void setup() { // Setup serial output Serial.begin(9600); // Do not run until a Serial connection is established while(!Serial) {;} Serial.println("Checking for SD Card..."); // Set up CD (Card Detect) to input mode pinMode(CD_PIN, INPUT); // wait for the CD to go high while(!digitalRead(CD_PIN)) { delay(250); } initCard(); printCardType(); getVolumeData(); } void loop() { // put your main code here, to run repeatedly: } /** * Setup the SdCard object. */ void initCard() { Serial.println("Setting up the SD Card..."); // init the card lib if(!card.init(SPI_HALF_SPEED, CS_PIN)) { Serial.println("Failed to init SD card!"); Serial.println("Reinsert card and restart..."); while(1); } else { Serial.println("Card detected, wiring looks good!"); } } /** * Simple function for printing the SD card type. * Currently supports: * 1. SD1 * 2. SD2 * 3. SDHC */ void printCardType() { // Get card type Serial.print("SD Card type: "); switch(card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("UNKNOWN"); } } /** * Run through the volume information in the SD card. This inlcudes: * 1. Cluster count * 2. # blocks per cluster * 3. block count * 4. volume type * 5. volume in Kb * 6. volume in Mb * 7. volume in Gb * 8. List all files in volume */ void getVolumeData() { if(!volume.init(card)) { Serial.println("Card is not formatted to FAT16/32, can't enumerate volume"); while(1); } else { // 1. Clusters Serial.print("Clusters: "); Serial.println(volume.clusterCount()); // 2. number of blocks per cluster Serial.print("# blocks per cluster: "); Serial.println(volume.blocksPerCluster()); // 3. Block count Serial.print("Total # blocks: "); Serial.println(volume.blocksPerCluster() * volume.clusterCount()); // Volume size in 32 bit int uint32_t volumeSize; // 4. Volume in type Serial.print("Volume type is: FAT"); Serial.println(volume.fatType(), DEC); // 5. volume in Kb volumeSize = volume.blocksPerCluster(); volumeSize *= volume.clusterCount(); // SD Card blocks are always 512 bytes (2 blocks are 1 KB) volumeSize /= 2; Serial.print("Volume size (Kb): "); Serial.println(volumeSize); // 6. volume in Mb volumeSize /= 1024; Serial.print("Volume size (Mb): "); Serial.println(volumeSize); // 6. volume in Gb Serial.print("Volume size (Gb): "); Serial.println((float)volumeSize/1024.0); // 8. List files Serial.println("File found on volume:"); SdFile root; root.openRoot(volume); root.ls(LS_R | LS_DATE | LS_SIZE); // close the root root.close(); } }
23.342857
80
0.632191
true
896
2b4057fcb64322e02073f25060bf7ff9066a5d72
468
ino
Arduino
examples/01.TurnOnLedIfButtonPressed/Example_01.ino
PeterKapor/Arduino-Button
ff0d1ebad3fd0458f8e2172ef5fcf9d886a0340f
[ "MIT" ]
null
null
null
examples/01.TurnOnLedIfButtonPressed/Example_01.ino
PeterKapor/Arduino-Button
ff0d1ebad3fd0458f8e2172ef5fcf9d886a0340f
[ "MIT" ]
null
null
null
examples/01.TurnOnLedIfButtonPressed/Example_01.ino
PeterKapor/Arduino-Button
ff0d1ebad3fd0458f8e2172ef5fcf9d886a0340f
[ "MIT" ]
0
null
null
#include "Button.h" #define LED_PIN 13 #define BUTTON_PIN 12 #define BUTTON_DEBOUNCE_TIME 10 Button button12(BUTTON_PIN, Button::ButtonInputSetting::DownIsLow, BUTTON_DEBOUNCE_TIME); void setup() { pinMode(LED_PIN, OUTPUT); } void loop() { // refresh state of the button button12.refresh(); // check the button state and set the LED state bool ledState = (button12.isDown()) ? HIGH : LOW; // turn on or off the LED digitalWrite(LED_PIN, ledState); }
18
89
0.726496
true
132
1ce2fe162ae499844e9b426bfc45cd4c99fa443c
1,993
ino
Arduino
arduino/opencr_arduino/opencr/libraries/OpenCR/examples/08. DynamixelWorkbench/o_Read_Write/o_Read_Write.ino
yemiaobing/opencr
8700d276f60cb72db4f1ed85deff26a5f96ce7b6
[ "Apache-2.0" ]
3
2019-12-06T08:28:21.000Z
2021-05-28T22:56:22.000Z
arduino/opencr_arduino/opencr/libraries/OpenCR/examples/08. DynamixelWorkbench/o_Read_Write/o_Read_Write.ino
yemiaobing/opencr
8700d276f60cb72db4f1ed85deff26a5f96ce7b6
[ "Apache-2.0" ]
null
null
null
arduino/opencr_arduino/opencr/libraries/OpenCR/examples/08. DynamixelWorkbench/o_Read_Write/o_Read_Write.ino
yemiaobing/opencr
8700d276f60cb72db4f1ed85deff26a5f96ce7b6
[ "Apache-2.0" ]
1
2019-02-03T04:49:15.000Z
2019-02-03T04:49:15.000Z
/******************************************************************************* * Copyright 2016 ROBOTIS CO., LTD. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /* Authors: Taehun Lim (Darby) */ #include <DynamixelWorkbench.h> #if defined(__OPENCM904__) #define DEVICE_NAME "3" //Dynamixel on Serial3(USART3) <-OpenCM 485EXP #elif defined(__OPENCR__) #define DEVICE_NAME "" #endif #define BAUDRATE 57600 #define DXL_ID 1 DynamixelWorkbench dxl_wb; void setup() { Serial.begin(57600); // while(!Serial); // If this line is activated, you need to open Serial Terminal. dxl_wb.begin(DEVICE_NAME, BAUDRATE); dxl_wb.ping(DXL_ID); dxl_wb.jointMode(DXL_ID); } void loop() { static int index = 0; int32_t present_position = 0; int32_t goal_position[2] = {1000, 2000}; dxl_wb.itemWrite(DXL_ID, "Goal_Position", goal_position[index]); do { present_position = dxl_wb.itemRead(DXL_ID, "Present_Position"); Serial.print("[ ID :" + String(DXL_ID) + " GoalPos :" + String(goal_position[index]) + " PresPos :" + String(present_position) + " ]"); Serial.println(""); }while(abs(goal_position[index] - present_position) > 20); if (index == 0) { index = 1; } else { index = 0; } }
28.471429
85
0.583041
true
492
39bac9fa059fb379c850177a29ed6483149bd440
5,091
ino
Arduino
drive-auto/drive-auto.ino
boothinator/arduino-videos
355136e7af29041984446157910b3f1dfd28e56d
[ "MIT" ]
null
null
null
drive-auto/drive-auto.ino
boothinator/arduino-videos
355136e7af29041984446157910b3f1dfd28e56d
[ "MIT" ]
null
null
null
drive-auto/drive-auto.ino
boothinator/arduino-videos
355136e7af29041984446157910b3f1dfd28e56d
[ "MIT" ]
0
null
null
void setup() { pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(5, OUTPUT); pinMode(9, OUTPUT); pinMode(11, OUTPUT); pinMode(6, OUTPUT); } void loop() { /* * Full course * |-----| |-----| * | | * | | * |-----| */ /* * Current position * X-----| |-----| * | | * | | * |-----| */ // Go forward for 1.5 seconds // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(1500); /* * Current position * |-----X |-----| * | | * | | * |-----| */ // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Turn right // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, LOW); analogWrite(6, 128); delay(750); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Go forward for 1.5 seconds // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(1500); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); /* * Current position * |-----| |-----| * | | * | | * X-----| */ // Turn left // Right motors digitalWrite(7, LOW); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(750); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Go forward for 1.5 seconds // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(1000); /* * Current position * |-----| |-----| * | | * | | * |-----X */ // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Turn left // Right motors digitalWrite(7, LOW); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(750); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Go forward for 1.5 seconds // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(1000); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); /* * Current position * |-----| X-----| * | | * | | * |-----| */ // Turn right // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, LOW); analogWrite(6, 128); delay(750); // Brake for half a second // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); delay(500); // Go forward for 1.5 seconds // Right motors digitalWrite(7, HIGH); digitalWrite(8, LOW); analogWrite(5, 128); // Right motors digitalWrite(9, LOW); digitalWrite(11, HIGH); analogWrite(6, 128); delay(1500); // Brake // Right motors digitalWrite(7, HIGH); digitalWrite(8, HIGH); analogWrite(5, 128); // Right motors digitalWrite(9, HIGH); digitalWrite(11, HIGH); analogWrite(6, 128); /* * Current position * |-----| |-----X * | | * | | * |-----| */ // Do nothing forever while(true) {} }
17.141414
31
0.555883
true
1,582
3397d64204480d13df06b3995614082f1422da1f
1,818
ino
Arduino
playground/LED7Segment/ShiftDriveSPI/ShiftDriveSPI.ino
novaprimexex/LittleArduinoProjects
382d9827459882c19afe20513cc1232214a047c6
[ "MIT" ]
1
2020-12-27T17:38:55.000Z
2020-12-27T17:38:55.000Z
playground/LED7Segment/ShiftDriveSPI/ShiftDriveSPI.ino
novaprimexex/LittleArduinoProjects
382d9827459882c19afe20513cc1232214a047c6
[ "MIT" ]
null
null
null
playground/LED7Segment/ShiftDriveSPI/ShiftDriveSPI.ino
novaprimexex/LittleArduinoProjects
382d9827459882c19afe20513cc1232214a047c6
[ "MIT" ]
0
null
null
/* LED7Segment/ShiftDriveSPI Using SPI to control a 7-segment display via a 74HC595 shift register For info and circuit diagrams see https://github.com/tardate/LittleArduinoProjects/tree/master/playground/LED7Segment/ShiftDriveSPI */ #include <SPI.h> SPISettings shiftRegisterSettings(2000000, MSBFIRST, SPI_MODE0); // Standard SPI pins are used used for clock and data, but slave select can be any free pin #define ST_CP_LATCH_PIN 4 #define STEP_DELAY 500 // define the bitmasks for characters 0-9 // where bits represent dp,G,F..A from MSB to LSB byte LED_DIGIT_MASK[] = { 0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111101, 0b00000111, 0b01111111, 0b01101111 }; // define the bitmasks for clear and decimal point #define LED_CLEAR_MASK 0b00000000 #define LED_DP_MASK 0b10000000 void setup() { SPI.begin(); pinMode(ST_CP_LATCH_PIN, OUTPUT); } void loop() { for(int d=0; d<10; d++) { writeDigit(d, d % 2 == 0); delay(STEP_DELAY); } clearDigit(); delay(STEP_DELAY); } // Command: send +data+ byte to the 74HC595 shift register using SPI // Note: since only using one SPI device, // beginTransaction()/endTransaction() is actually redundant here // SPI setup could be done in the setup() function void pushSegmentRegister(byte data) { SPI.beginTransaction(shiftRegisterSettings); digitalWrite(ST_CP_LATCH_PIN, LOW); SPI.transfer(data); digitalWrite(ST_CP_LATCH_PIN, HIGH); SPI.endTransaction(); } void writeDigit(byte digit, boolean withDP) { if(withDP) pushSegmentRegister(LED_DIGIT_MASK[digit] | LED_DP_MASK); else pushSegmentRegister(LED_DIGIT_MASK[digit]); } void writeDigit(byte digit) { pushSegmentRegister(LED_DIGIT_MASK[digit]); } void clearDigit() { pushSegmentRegister(LED_CLEAR_MASK); }
22.170732
133
0.744224
true
520
ceaf11d7f268d359a3557126ee4e8ae9f7a609c7
330
ino
Arduino
shutter_speed_checker.ino
omegaatt36/shutter_speed_checker
730fbe03e295d17d04782d61e164eb1b858754a9
[ "MIT" ]
null
null
null
shutter_speed_checker.ino
omegaatt36/shutter_speed_checker
730fbe03e295d17d04782d61e164eb1b858754a9
[ "MIT" ]
null
null
null
shutter_speed_checker.ino
omegaatt36/shutter_speed_checker
730fbe03e295d17d04782d61e164eb1b858754a9
[ "MIT" ]
0
null
null
#include <Wire.h> // Arduino IDE 內建 int receiverPin = 0; // 宣告腳位2名稱為receiverPin unsigned long duration; // 持續時間 void setup() { pinMode(receiverPin, INPUT); //把receiverPin設為輸入 INPUT Serial.begin(9600); // // 開啟 Serial port, 通訊速率為 9600 bps } void loop() { duration = pulseIn(receiverPin, LOW); Serial.print(duration); }
23.571429
59
0.69697
true
113
939a12d0c28cb8615d373564a2dfe2e9f2375ee8
11,862
ino
Arduino
badge_leds_serial.ino
scottymuse/badge_leds_serial
116256a57c16c11fd0b6c7dc06e5d10e1aad8029
[ "MIT" ]
null
null
null
badge_leds_serial.ino
scottymuse/badge_leds_serial
116256a57c16c11fd0b6c7dc06e5d10e1aad8029
[ "MIT" ]
null
null
null
badge_leds_serial.ino
scottymuse/badge_leds_serial
116256a57c16c11fd0b6c7dc06e5d10e1aad8029
[ "MIT" ]
0
null
null
/* AUTHOR: Scott Nielsen (scotty) Thanks to Klint Holmes. I used a lot of his original badge code here and to learn this stuff. And Thanks to Luke Jenkins, Klint Holmes, Matt Lorimer, and Jonathan Karras for these badges! To use: Load this program onto the SaintCON 2014 badge. This does not require any additional hardware. To run, connect the badge via USB to your computer, run your favorite serial terminal. Use the same settings used in the 'Hack the badge' challenges at the con. baud = 115200 data bits = 8 stop bits = 1 parity = None Flow control = xon/xoff The menu presented offers options of controlling the leds around the name plate. The neat thing about this program is the leds are entirely controlled by timer interrupts on the processor, leaving the main loop to run the serial interface. My next steps on this project are to include a button on the badge to toggle through the display options, and a potentiometer connected to an analog input to control the speed. That will allow entire removal of the serial interface (everything in the 'void loop()') and you can then run whatever program you want and still have the control over the led blinking pattern. A known issue is the interrupts are controlled by a timer on the processor which when used disables the PWM ability on some of the pins. Specifically in this program, the pins controlling the top leds on the name plate are affected, removing their ability to fade easily with analogWrite(). So I do not include the top leds in the fade patterns. IMPORTANT TIP: If you want to monkey with this code and load it onto your badge, make sure you kill your serial connection before you push the code to the badge. You get some strange, even somewhat frightening, errors sometimes if the serial connection is open. */ int leds_ordered[4]; const int tl = leds_ordered[0] = 10; const int tr = leds_ordered[1] = 9;; const int br = leds_ordered[2] = 6; const int bl = leds_ordered[3] = 11; volatile int led_state = 0; // an int between 0 and 15, 4 bits, each representing an led #define ALL_STATES ((1 << 3) | (1 << 2) | (1 << 1) | (1 << 0)) #define TL (1 << 0) #define TR (1 << 1) #define BR (1 << 2) #define BL (1 << 3) const int pattern_all_blink = 0; const int pattern_rotate = 1; const int pattern_cc_rotate = 2; const int pattern_sync_fade = 3; const int pattern_alt_fade = 4; const int pattern_up_down = 5; const int pattern_side_side = 6; const int pattern_diagonals = 7; const int pattern_random_toggles = 8; const int pattern_all_off = 9; const int pattern_all_on = 10; volatile int pattern = pattern_all_blink; boolean fade_initialized = false; boolean random_toggles_initialized = false; boolean show = true; int incomingByte = 0; int previousByte = 0; const long prescaler = 62500; volatile float hz = 2.0; void enforce_state() { // Check the bits in led_state, any 1's turn the led on. any 0's turn the led off. for (int i = 0; i < 4; i++) { if (led_state & 1 << i) digitalWrite(leds_ordered[i], HIGH); else digitalWrite(leds_ordered[i], LOW); } } void all_on() { led_state = BR | BL | TL | TR; enforce_state(); } void all_off() { led_state = 0; enforce_state(); } void all_blink() { if (led_state == 0) all_on(); else all_off(); } void rotate_leds() { if (led_state == TL || led_state == TR || led_state == BR) led_state = led_state << 1; else if (led_state == BL) led_state = led_state >> 3; else led_state = 1; enforce_state(); } void rotate_cc_leds() { if (led_state == TR || led_state == BR || led_state == BL) led_state = led_state >> 1; else if (led_state == TL) led_state = led_state << 3; else led_state = 1; enforce_state(); } void fade(boolean synchronous) { // Sigh....the timing interrupt used disables PWM on the top two leds. Fading is not an easy option for them. :( static bool moving; static bool rising; static int intensity; static unsigned long previous; float hold_interval = 10000/hz; if (!fade_initialized) { moving = true; rising = true; intensity = 0; previous = 0; fade_initialized = true; all_off(); } if(moving) { OCR1A = prescaler/hz/60; if (rising) intensity += 1; else intensity -= 1; analogWrite(leds_ordered[2], intensity); if (synchronous) analogWrite(leds_ordered[3], intensity); else analogWrite(leds_ordered[3], 255 - intensity); if (intensity == 255) { moving = false; rising = false; OCR1A = prescaler/hz; if (synchronous) led_state = BR | BL; else led_state = BR; enforce_state(); } else if (intensity == 0) { moving = false; rising = true; OCR1A = prescaler/hz; if (synchronous) led_state = 0; else led_state = BL; enforce_state(); } return; } unsigned long current = millis(); if(current - previous > hold_interval) { moving = true; previous = current; } } void doubles(int pattern) { int initialState; if (pattern == pattern_up_down) initialState = (TL | TR); if (pattern == pattern_side_side) initialState = (TL | BL); if (pattern == pattern_diagonals) initialState = (TL | BR); if (led_state == initialState || led_state == (initialState ^ ALL_STATES)) led_state = led_state ^ ALL_STATES; else led_state = initialState; enforce_state(); } void random_toggles() { static unsigned long previous; static float hold_interval; if (!random_toggles_initialized) { previous = 0; hold_interval = random(1000/hz, 5000/hz); random_toggles_initialized = true; } unsigned long current = millis(); if (current - previous > hold_interval) { led_state = (led_state ^ random(1, 16)); enforce_state(); hold_interval = random(1000/hz, 5000/hz); previous = current; } } ISR(TIMER1_COMPA_vect) { // Function that runs when the interrupt is thrown if (pattern == pattern_all_blink) all_blink(); else if (pattern == pattern_rotate) rotate_leds(); else if (pattern == pattern_cc_rotate) rotate_cc_leds(); else if (pattern == pattern_sync_fade) fade(true); else if (pattern == pattern_alt_fade) fade(false); else if (pattern == pattern_up_down) doubles(pattern_up_down); else if (pattern == pattern_side_side) doubles(pattern_side_side); else if (pattern == pattern_diagonals) doubles(pattern_diagonals); else if (pattern == pattern_random_toggles) random_toggles(); } void clearScreen() { Serial.write(27); // ESC command Serial.print("[2J"); // clear screen command Serial.write(27); // ESC Serial.print("[H"); // Set Cursor to Home } void mainMenu() { clearScreen(); Serial.println("+-------------------------------------------+"); Serial.println("| 1) all blink |"); Serial.println("| 2) rotate clockwise / counter clockwise |"); Serial.println("| 3) up-down / side-side / diagonals |"); Serial.println("| 4) synchronous / alternate fade |"); Serial.println("| 5) random toggles |"); Serial.println("| 0) all on / off |"); Serial.println("| |"); Serial.print("| Current speed: "); Serial.print(hz, 1); if (hz < 10) Serial.println(" Hz |"); else if (hz >= 10 && hz < 100) Serial.println(" Hz |"); else if (hz >= 100.00) Serial.println(" Hz |"); Serial.println("| +) increase speed |"); Serial.println("| -) decrease speed |"); Serial.println("+-------------------------------------------+"); } void setup() { pinMode(tl, OUTPUT); pinMode(bl, OUTPUT); pinMode(tr, OUTPUT); pinMode(br, OUTPUT); pinMode(13, OUTPUT); randomSeed(analogRead(0)); noInterrupts(); TCCR1A = 0; // Timer1 A register TCCR1B = 0; // Timer1 B register TCNT1 = 0; // Timer1 counter. /* EXPLANATION OF THE INTERRUPT VARIABLES When Timer1 counter (TCNT1) hits the value in OCR1A it will throw the TIMER1_COMPA_vect interrupt. To calculate OCR1A: 16MHz / TCCR1B prescaler value / desired Hz - to throw the interrupt. For example, if you want your interrupt to run 2 times every second ( 2 Hz ) do this: 16MHz / 256 / 2Hz ---- That's 16000000 / 256 / 2. 16MHz because that is the speed of the processor 256 because TCCR1B has the CS12 bit set, which means 256 prescaler. The counter for Timer1 is only 16 bits so OCR1A has to be < 65535. This scalar allows greater flexability for when the interrupt throws. But in this program I keep it at 256. Timer0 and Timer2 are only 8 bit (i.e. OCRxA < 256), so the scalar is probably much more important when using those timers. 2 because we want the interrupt to run twice every second i.e. 2 Hz. I had to read this page about 157 times before I achieved my minimal understanding of this stuff: http://letsmakerobots.com/node/28278 */ OCR1A = prescaler/hz; // Here prescaler = 16MHz/256. I mixed the two numbers because I could. hz is variable, but starts at 2. TCCR1B |= (1 << WGM12); // This bit means throw the exception when TCNT1 == OCR1A TCCR1B |= (1 << CS12); // This bit means our prescaler is 256 TIMSK1 |= (1 << OCIE1A); // This bit actually turns on the interrupt. If this is not set, the interrupt will not be thrown. // You will notice this bit gets unset for the all_on and all_off patterns. I didn't have to turn it off, but I could. Why not? interrupts(); Serial.begin(115200); } void loop() { if (show) { mainMenu(); show = false; } if (Serial.available() > 0) { incomingByte = Serial.read(); if (previousByte == 52) { // Make sure we initialze the fade pattern if we go back into it again, and set the interrupt counter back to normal. fade_initialized = false; OCR1A = prescaler/hz; } if (previousByte == 48 && incomingByte != 48) { // Turn the interrupt back on if we are leaving an all_on or all_off pattern. TIMSK1 |= (1 << OCIE1A); } if (incomingByte == 43) { // '+' hz += 0.1; OCR1A = prescaler/hz; show = true; } if (incomingByte == 45) { // '-' hz -= 0.1; if (hz < 1) hz = 1.0; OCR1A = prescaler/hz; show = true; } if (incomingByte == 49) { // '1' pattern = pattern_all_blink; previousByte = incomingByte; } if (incomingByte == 50) { // '2' if (pattern == pattern_rotate) pattern = pattern_cc_rotate; else { pattern = pattern_rotate; previousByte = incomingByte; } } if (incomingByte == 51) { // '3' if (pattern == pattern_up_down) pattern = pattern_side_side; else if (pattern == pattern_side_side) pattern = pattern_diagonals; else { pattern = pattern_up_down; previousByte = incomingByte; } } if (incomingByte == 52) { // '4' if (pattern == pattern_sync_fade) pattern = pattern_alt_fade; else { pattern = pattern_sync_fade; previousByte = incomingByte; } } if (incomingByte == 53) { // '5' pattern = pattern_random_toggles; previousByte = incomingByte; } if (incomingByte == 48) { // '0' if (pattern == pattern_all_on) { pattern = pattern_all_off; all_off(); } else { pattern = pattern_all_on; previousByte = incomingByte; TIMSK1 &= (0 << OCIE1A); // Turn off the interupt. We won't be using it here. all_on(); } } } }
30.03038
147
0.630754
true
3,148
b6a4291b178a78222f87e4ff97ac73ba78ce47d3
1,231
ino
Arduino
arduino/test_pca9685/test_pca9685.ino
serge-m/pwm_radio_arduino
2f5581900ecbdf98e1a1af7ded7bd033d4e0fd30
[ "MIT" ]
null
null
null
arduino/test_pca9685/test_pca9685.ino
serge-m/pwm_radio_arduino
2f5581900ecbdf98e1a1af7ded7bd033d4e0fd30
[ "MIT" ]
null
null
null
arduino/test_pca9685/test_pca9685.ino
serge-m/pwm_radio_arduino
2f5581900ecbdf98e1a1af7ded7bd033d4e0fd30
[ "MIT" ]
0
null
null
#include <Adafruit_PWMServoDriver.h> // using the default address 0x40 Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); // Analog servos run at ~60 Hz updates int frequency_ = 60; void setup() { Serial.begin(57600); Serial.println("Starting servo test"); pwm.begin(); pwm.setPWMFreq(frequency_); pinMode(LED_BUILTIN, OUTPUT); delay(10); } int pulseWidth(int pulse_width) // width between 0 and 4096 { return (int)(float(pulse_width) / 1000000 * frequency_ * 4096); } void set_and_delay(int servonum, int pulse_width, int delay_time) { Serial.print("Running on servo "); Serial.print(servonum); Serial.print(" pulse "); Serial.println(pulse_width); pwm.setPWM(servonum, 0, pulseWidth(pulse_width)); delay(delay_time); } void blink1(int times, int duration_blink, int duration_after=1) { for (int i = 0; i < times; ++i) { digitalWrite(LED_BUILTIN, HIGH); delay(duration_blink/2); digitalWrite(LED_BUILTIN, LOW); delay(duration_blink/2); } delay(duration_after); } void loop() { set_and_delay(0, 1400, 1000); blink1(3, 100); set_and_delay(0, 1600, 1000); blink1(2, 100); set_and_delay(0, 1200, 1000); blink1(1, 100); set_and_delay(0, 1500, 1000); }
22.381818
67
0.696994
true
380
ea9714a4ac9e70dc67aac3420f50f2e62ee13a43
982
ino
Arduino
test_atmega8/test_atmega8.ino
oloturia/atmega8_test
ab91e7f7dff855514a790a0002328064e63bcbda
[ "Unlicense" ]
null
null
null
test_atmega8/test_atmega8.ino
oloturia/atmega8_test
ab91e7f7dff855514a790a0002328064e63bcbda
[ "Unlicense" ]
null
null
null
test_atmega8/test_atmega8.ino
oloturia/atmega8_test
ab91e7f7dff855514a790a0002328064e63bcbda
[ "Unlicense" ]
0
null
null
void setup() { Serial.begin(9600); Serial.println("Ready"); pinMode(5,OUTPUT); //fw motor 1 pinMode(6,OUTPUT); //bk motor 1 pinMode(7,OUTPUT); //fw motor 2 pinMode(8,OUTPUT); //bk motor 2 pinMode(9,OUTPUT); //analog motor 1 pinMode(10,OUTPUT);//analog motor 2 } void motorAction(int fwm, int bkm,int anm,int motspeed) { if (motspeed > 0 ) { digitalWrite(fwm,HIGH); digitalWrite(bkm,LOW); } else if (motspeed < 0) { digitalWrite(fwm,LOW); digitalWrite(bkm,HIGH); } else { digitalWrite(fwm,LOW); digitalWrite(bkm,LOW); } //analogWrite(anm,abs(motspeed)); analogWrite(anm,255); } void loop() { int x; int y; while (Serial.available() >0) { int x = Serial.parseInt(); int y = Serial.parseInt(); if (Serial.read() == *"q") { motorAction(5,6,9,x); motorAction(7,8,10,y); Serial.print(x); Serial.print(" "); Serial.println(y); } } }
23.380952
57
0.57332
true
299
70341f984ca1696c7f5226ab20f03a264a66e0ec
49,053
ino
Arduino
VanLiveConnect/DSEG14Classic-BoldItalic.woff.ino
0xCAFEDECAF/VanLiveConnect
4865ca992697c581693db97abc3563166408f9dc
[ "MIT" ]
10
2021-06-14T14:00:27.000Z
2022-03-24T22:48:53.000Z
VanLiveConnect/DSEG14Classic-BoldItalic.woff.ino
0xCAFEDECAF/VanLiveConnect
4865ca992697c581693db97abc3563166408f9dc
[ "MIT" ]
1
2022-03-24T23:34:54.000Z
2022-03-25T12:08:45.000Z
VanLiveConnect/DSEG14Classic-BoldItalic.woff.ino
0xCAFEDECAF/VanLiveConnect
4865ca992697c581693db97abc3563166408f9dc
[ "MIT" ]
0
null
null
// Generate with: // % xxd --include .../DSEG14Classic-BoldItalic.woff > /tmp/DSEG14Classic-BoldItalic.woff.ino char DSEG14Classic_BoldItalic_woff[] PROGMEM = { 0x77, 0x4f, 0x46, 0x46, 0x4f, 0x54, 0x54, 0x4f, 0x00, 0x00, 0x1e, 0x84, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x46, 0x46, 0x20, 0x00, 0x00, 0x15, 0x9c, 0x00, 0x00, 0x08, 0x4d, 0x00, 0x00, 0x17, 0xa3, 0x8a, 0x28, 0x4d, 0x05, 0x46, 0x46, 0x54, 0x4d, 0x00, 0x00, 0x1e, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x80, 0xa9, 0x30, 0x0c, 0x47, 0x44, 0x45, 0x46, 0x00, 0x00, 0x1d, 0xec, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x15, 0x00, 0x14, 0x4f, 0x53, 0x2f, 0x32, 0x00, 0x00, 0x01, 0x6c, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x60, 0x5b, 0x81, 0x69, 0xfb, 0x63, 0x6d, 0x61, 0x70, 0x00, 0x00, 0x14, 0xb0, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x01, 0x82, 0x62, 0x51, 0x92, 0xb8, 0x68, 0x65, 0x61, 0x64, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x36, 0x0c, 0x64, 0xa4, 0xe2, 0x68, 0x68, 0x65, 0x61, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x24, 0x06, 0xd5, 0x03, 0x9e, 0x68, 0x6d, 0x74, 0x78, 0x00, 0x00, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0xf4, 0x5c, 0xf6, 0x1b, 0xd3, 0x6d, 0x61, 0x78, 0x70, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x5e, 0x50, 0x00, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x01, 0xb8, 0x00, 0x00, 0x12, 0xf6, 0x00, 0x00, 0x38, 0x40, 0xb5, 0xcd, 0xa1, 0xbc, 0x70, 0x6f, 0x73, 0x74, 0x00, 0x00, 0x15, 0x84, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x20, 0xff, 0x81, 0x00, 0x32, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x75, 0xc2, 0x7c, 0x20, 0xf3, 0x01, 0x5f, 0x0f, 0x3c, 0xf5, 0x00, 0x0b, 0x03, 0xe8, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x28, 0xc5, 0x9e, 0x00, 0x00, 0x00, 0x00, 0xda, 0x93, 0x24, 0xb5, 0xff, 0x96, 0x00, 0x00, 0x02, 0xf2, 0x03, 0xe8, 0x00, 0x03, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x9c, 0x63, 0x60, 0x64, 0x60, 0x60, 0x7e, 0xc1, 0xc0, 0xc0, 0x10, 0xc5, 0x6c, 0xf0, 0x7f, 0xda, 0xff, 0x77, 0x4c, 0x9f, 0x18, 0x52, 0x18, 0x38, 0x19, 0x90, 0x81, 0x0c, 0x00, 0x93, 0x72, 0x06, 0x79, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x78, 0x9c, 0x63, 0x60, 0x61, 0x56, 0x62, 0xda, 0xc3, 0xc0, 0xca, 0xc0, 0xc1, 0xd4, 0x05, 0xa4, 0x79, 0x18, 0x7a, 0x40, 0xf4, 0xff, 0xeb, 0x8c, 0x0f, 0x18, 0x0c, 0x19, 0x99, 0x18, 0x18, 0x98, 0x18, 0x38, 0x98, 0x19, 0x60, 0x00, 0xc1, 0x02, 0x82, 0x80, 0x34, 0xd7, 0x14, 0x86, 0x85, 0x0c, 0x0a, 0x0c, 0x1b, 0x99, 0x5f, 0x00, 0xb9, 0x51, 0x60, 0x92, 0x81, 0x81, 0x11, 0xac, 0xf0, 0x05, 0x90, 0xa7, 0x00, 0x84, 0x8c, 0x00, 0xce, 0x1d, 0x0e, 0x35, 0x00, 0x00, 0x78, 0x9c, 0xc5, 0x5b, 0xdb, 0x6e, 0x23, 0x47, 0x7a, 0x2e, 0x8d, 0xbd, 0x8b, 0xb8, 0x62, 0x1b, 0x08, 0x36, 0xd9, 0x35, 0x16, 0xb9, 0x28, 0x08, 0x89, 0x31, 0x02, 0x5a, 0x9c, 0x91, 0x66, 0x3c, 0x36, 0x74, 0xb5, 0x1c, 0x92, 0x1a, 0x11, 0x43, 0x91, 0x32, 0x49, 0x79, 0x76, 0xae, 0x16, 0xad, 0x66, 0x51, 0xec, 0x15, 0xbb, 0x9b, 0xdb, 0xdd, 0xa4, 0x4c, 0x24, 0x17, 0x41, 0x1e, 0x25, 0x6f, 0x91, 0xdb, 0xe4, 0x25, 0x72, 0x9b, 0x8b, 0x5c, 0x27, 0x40, 0x5e, 0x20, 0xd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 0xf5, 0x99, 0x1a, 0x82, 0xd4, 0x3a, 0xaf, 0x65, 0x69, 0xc4, 0x5d, 0xf1, 0x95, 0x1b, 0x85, 0xac, 0xca, 0x56, 0x96, 0x6c, 0x81, 0x08, 0x2a, 0x6c, 0xce, 0x20, 0xd3, 0x84, 0x2a, 0x03, 0xb9, 0x0c, 0xd6, 0x9a, 0x84, 0x04, 0xe4, 0xec, 0x4c, 0xca, 0x93, 0x23, 0xd5, 0xd7, 0xa1, 0xc9, 0x60, 0x5b, 0xae, 0x8c, 0x93, 0xd4, 0x21, 0x26, 0x84, 0xe7, 0x43, 0xec, 0x43, 0xb6, 0x5d, 0x02, 0x21, 0x25, 0x78, 0x3c, 0x04, 0xb4, 0x2a, 0x90, 0x83, 0x0d, 0x9b, 0xa0, 0x46, 0x70, 0xbb, 0xa2, 0x66, 0x4b, 0x06, 0x68, 0xe9, 0xf9, 0x14, 0x4e, 0x39, 0x3d, 0x7a, 0x78, 0xe7, 0x4e, 0x83, 0x3a, 0x6a, 0xae, 0x74, 0xfc, 0x31, 0xf5, 0xc2, 0xdb, 0x28, 0x18, 0xda, 0x47, 0x76, 0x20, 0x87, 0x48, 0x82, 0x10, 0x9c, 0x69, 0x2a, 0x27, 0x5a, 0x84, 0x95, 0x56, 0x65, 0xae, 0x40, 0x3a, 0x46, 0x86, 0x33, 0x35, 0xbd, 0x92, 0xef, 0x38, 0xc7, 0x23, 0xed, 0x99, 0x5a, 0xe6, 0x12, 0xdb, 0x44, 0x59, 0x7b, 0x52, 0xf6, 0xc9, 0xb1, 0xe7, 0xd8, 0x47, 0x01, 0x45, 0x5c, 0xe8, 0x1f, 0x73, 0x97, 0xed, 0x66, 0xcb, 0xc8, 0x8f, 0x8f, 0x91, 0xca, 0x27, 0xdc, 0xcc, 0xcd, 0x30, 0xa0, 0x98, 0x48, 0x52, 0x32, 0x26, 0x4b, 0xb0, 0x80, 0xa0, 0x8b, 0x34, 0xa4, 0x6e, 0x26, 0x82, 0x90, 0x88,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 0x1f, 0x10, 0x18, 0x14, 0x1c, 0x12, 0x1a, 0x16, 0xce, 0x10, 0xc1, 0x10, 0x49, 0xc0, 0x76, 0x20, 0x88, 0x41, 0xe3, 0xc7, 0x32, 0x00, 0x83, 0x81, 0x7a, 0x00, 0x00, 0x32, 0x19, 0x2d, 0xdc, 0x00, 0x00, 0x00, 0x78, 0x9c, 0x63, 0x60, 0x66, 0x60, 0xf8, 0xff, 0x1b, 0x88, 0x9b, 0x19, 0x8c, 0x18, 0xb0, 0x00, 0x00, 0x5e, 0xa1, 0x03, 0xb2, 0x00, 0x00, 0x00, 0x78, 0x9c, 0xed, 0x58, 0x7d, 0x50, 0x54, 0xd7, 0x15, 0x3f, 0x6f, 0x97, 0x07, 0xcb, 0x7b, 0xcb, 0x7e, 0x3d, 0x9f, 0x1f, 0x09, 0x98, 0x55, 0x17, 0x82, 0x28, 0xcb, 0x82, 0x80, 0x1a, 0xdb, 0xea, 0xf8, 0x99, 0xa0, 0x50, 0xad, 0x8a, 0xa9, 0x4d, 0x54, 0xc2, 0x77, 0x43, 0x5c, 0x02, 0x0c, 0x4c, 0x14, 0x5b, 0x0b, 0xac, 0xa8, 0x4f, 0xbe, 0x56, 0x68, 0x0b, 0x35, 0x91, 0x76, 0x3a, 0x3a, 0xa5, 0x93, 0xc1, 0xd4, 0x6a, 0xa8, 0x13, 0x46, 0x5a, 0xc5, 0x31, 0x64, 0x88, 0x4c, 0x64, 0xf2, 0x47, 0x9c, 0x56, 0x33, 0x53, 0x1b, 0xfe, 0x68, 0xd1, 0x71, 0x32, 0xdc, 0xb7, 0xbc, 0x25, 0xe9, 0x7d, 0xfb, 0xde, 0x63, 0x1f, 0xec, 0xae, 0x18, 0xa6, 0xff, 0x74, 0x86, 0xdd, 0x19, 0xd8, 0xbd, 0xef, 0xfe, 0xce, 0x39, 0xf7, 0x9c, 0xdf, 0x39, 0xf7, 0xec, 0x21, 0x20, 0x2c, 0x0c, 0x08, 0x82, 0x58, 0xb4, 0x79, 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d, 0x68, 0xb1, 0x85, 0xe1, 0x10, 0x01, 0x45, 0x10, 0x09, 0x14, 0xd0, 0xa0, 0x87, 0x28, 0x30, 0x80, 0x11, 0x4c, 0x60, 0x06, 0x0b, 0x30, 0x30, 0x0f, 0x58, 0x98, 0x0f, 0x0b, 0x60, 0x21, 0x2c, 0x82, 0xe7, 0xe0, 0x79, 0x88, 0x81, 0xc5, 0xf0, 0x02, 0x58, 0x61, 0x09, 0x2c, 0x85, 0x65, 0x60, 0x83, 0x58, 0x88, 0x83, 0x17, 0x21, 0x1e, 0x96, 0x43, 0x02, 0xac, 0x80, 0x95, 0x90, 0x08, 0x76, 0x48, 0x02, 0x07, 0x24, 0x43, 0x0a, 0xac, 0x82, 0x54, 0x48, 0x83, 0x74, 0x58, 0x0d, 0x6b, 0x60, 0x2d, 0xbc, 0x04, 0xeb, 0xe0, 0xfb, 0xb0, 0x1e, 0x36, 0x40, 0x35, 0x6c, 0x84, 0x4d, 0xb0, 0x19, 0xb6, 0xc0, 0x56, 0xd8, 0x06, 0x2f, 0xc3, 0x2b, 0x90, 0x01, 0xdb, 0x61, 0x07, 0x64, 0x42, 0x16, 0xfc, 0x10, 0x76, 0xc2, 0x2e, 0xf8, 0x11, 0xec, 0x86, 0x3d, 0xb0, 0x17, 0xb2, 0x61, 0x1f, 0xbc, 0x0a, 0x3f, 0x86, 0xfd, 0xf0, 0x13, 0x78, 0x1d, 0x0e, 0x42, 0x1e, 0x74, 0xc2, 0x6f, 0xe1, 0x1c, 0x1c, 0x10, 0x5d, 0x6b, 0xf3, 0xa9, 0xce, 0x82, 0x6e, 0xf8, 0x9a, 0x48, 0x21, 0x36, 0x11, 0xfb, 0x89, 0xb7, 0x89, 0x0f, 0x88, 0x61, 0xe2, 0x21, 0xc1, 0x6b, 0x8a, 0x34, 0x47, 0x35, 0xc3, 0x9a, 0x27, 0xda, 0x75, 0xda, 0x5f, 0x68, 0xbb, 0xb5, 0x4f, 0xc2, 0x7e, 0x10, 0x56, 0x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 0x00, 0x00, 0xd0, 0x28, 0xc5, 0x9e, 0x00, 0x00, 0x00, 0x00, 0xda, 0x93, 0x24, 0xb5, 0x78, 0x9c, 0x63, 0xfc, 0xc2, 0xc0, 0xc0, 0x70, 0x82, 0x81, 0x81, 0xd9, 0x00, 0x8c, 0x53, 0x90, 0x70, 0x3a, 0xb3, 0x01, 0x63, 0x2a, 0x10, 0x5f, 0x06, 0xb2, 0xaf, 0x00, 0xf1, 0x7a, 0x28, 0x06, 0xb3, 0x19, 0x18, 0xfe, 0x4f, 0x83, 0xb2, 0xed, 0x98, 0x0d, 0x98, 0x0c, 0x21, 0x34, 0x48, 0x0f, 0x5c, 0xbf, 0x1d, 0x32, 0x0d, 0xb4, 0x43, 0x04, 0x24, 0x0f, 0x86, 0x29, 0x0c, 0x76, 0x40, 0x98, 0x0e, 0xc5, 0x76, 0x70, 0x1e, 0x3a, 0x4c, 0x61, 0xd8, 0x09, 0x65, 0x5d, 0x61, 0x64, 0x64, 0x48, 0x07, 0xe2, 0x14, 0x30, 0x49, 0x8e, 0x5e, 0x6b, 0x20, 0x6b, 0x3d, 0x90, 0x04, 0x9a, 0x00, 0x00, 0xd0, 0xc9, 0x28, 0x1b }; unsigned int DSEG14Classic_BoldItalic_woff_len = 7812;
74.435508
95
0.640491
true
40,525
7f8112e0a20b00716f29951cea6b15e6359685f2
6,143
ino
Arduino
Performances/mostra qwerty/arduino/MIDI_DELAY_SIN_v6/MIDI_DELAY_SIN_v6.ino
JoakuDeSotavento/Joakinator
71384d54cb7bd3d9030fddf50d838df5116af22b
[ "MIT" ]
null
null
null
Performances/mostra qwerty/arduino/MIDI_DELAY_SIN_v6/MIDI_DELAY_SIN_v6.ino
JoakuDeSotavento/Joakinator
71384d54cb7bd3d9030fddf50d838df5116af22b
[ "MIT" ]
null
null
null
Performances/mostra qwerty/arduino/MIDI_DELAY_SIN_v6/MIDI_DELAY_SIN_v6.ino
JoakuDeSotavento/Joakinator
71384d54cb7bd3d9030fddf50d838df5116af22b
[ "MIT" ]
0
null
null
/* Blink without Delay Turns on and off a light emitting diode (LED) connected to a digital pin, without using the delay() function. This means that other code can run at the same time without being interrupted by the LED code. The circuit: - Use the onboard LED. - Note: Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to the correct LED pin independent of which board is used. If you want to know what pin the on-board LED is connected to on your Arduino model, check the Technical Specs of your board at: https://www.arduino.cc/en/Main/Products created 2005 by David A. Mellis modified 8 Feb 2010 by Paul Stoffregen modified 11 Nov 2013 by Scott Fitzgerald modified 9 Jan 2017 by Arturo Guadalupi This example code is in the public domain. http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay */ /* MIDI note player This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. If this circuit is connected to a MIDI synth, it will play the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence. The circuit: - digital in 1 connected to MIDI jack pin 5 - MIDI jack pin 2 connected to ground - MIDI jack pin 4 connected to +5V through 220 ohm resistor - Attach a MIDI cable to the jack, then to a MIDI synth, and play music. created 13 Jun 2006 modified 13 Aug 2012 by Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Midi */ #include <Tone.h> // These constants won't change: // const int sensorPin = A0; // pin that the sensor is attached to // const int ledPin = 9; // pin that the LED is attached to ////// capacitive sensor///// //CapacitiveSensor cs_11_10 = CapacitiveSensor(11, 10); //CapacitiveSensor cs_8_7 = CapacitiveSensor(8, 7); //const int ON_11_10 = 1000; //const int ON_8_7 = 1000; ////// Sound part /////////////////// Tone tone1, tone2; int kumoy[] = { NOTE_F4, NOTE_G4, NOTE_GS4, NOTE_B4, NOTE_C5, NOTE_D5, NOTE_DS5, NOTE_E5, NOTE_F5 }; const unsigned int fraqTemp[] = { 1, 2, 4, 8, 16, 32, 64 }; ////// calibraciion del sensor #define muscle A0 // variables: int sensorValue = 0; // the sensor value int sensorMin = 1023; // minimum sensor value int sensorMax = 0; // maximum sensor value unsigned int tempo = 16; unsigned int ritmo[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; //int ritmo2[16][3] = { // {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}, // {1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} //}; //////// ////// MIDI part ////////////////////// unsigned int MIDINotes[] = {21, 28, 30, 31, 35, 36, 40, 42, 43, 47, 48, 52, 54, 55, 59, 60, 64, 66, 67, 71, 72 }; unsigned int contRitmo = 0; //int cmd = 0x99; int cmd = 144; int pitch = 0x3c; int velocity = 0x64; /////////// no delay clock // constants won't change. Used here to set a pin number: const int ledPin = LED_BUILTIN;// the number of the LED pin // Variables will change: int ledState = LOW; // ledState used to set the LED // Generally, you should use "unsigned long" for variables that hold time // The value will quickly become too large for an int to store unsigned long previousMillis = 0; // will store last time LED was updated // constants won't change: const long interval = 500; // interval at which to blink (milliseconds) void setup() { // calibrate during the first five seconds while (millis() < 5000) { sensorValue = analogRead(muscle); // record the maximum sensor value if (sensorValue > sensorMax) { sensorMax = sensorValue; } // record the minimum sensor value if (sensorValue < sensorMin) { sensorMin = sensorValue; } } /*/////////////////////////////////////////////////////////////////////////////////////*/ // Set MIDI baud rate: Serial.begin(31250); // set the digital pin as output: pinMode(ledPin, OUTPUT); } void loop() { // here is where you'd put code that needs to be running all the time. // check to see if it's time to blink the LED; that is, if the difference // between the current time and last time you blinked the LED is bigger than // the interval at which you want to blink the LED. //tone1.play(); unsigned long currentMillis = millis(); //int note = 0x5F; int soundSin = random(0, 8); //int noteRan = random(0x1E, 0x5A); //int noteRan = 0x3E; sensorValue = analogRead(muscle); // this define the index for the array with the division of time int muscleSen = map (sensorValue, sensorMin, sensorMax, 0, 5); // this define the index for the array of notes int muscleNote = map (sensorValue, sensorMin, sensorMax, 0, 20); // filter that just makes the sensor produce sound when it is bigger in numbers if (muscleSen > 1) { clockMIDI(currentMillis, MIDINotes[muscleNote + random(-1, 1)], soundSin, muscleSen); } } void clockMIDI(unsigned long _currentMillis, int _noteRan, int _soundSin, int _muscleSen) { if (_currentMillis - previousMillis >= interval / fraqTemp[_muscleSen]) { if (contRitmo >= tempo - 1) { contRitmo = 0; } // save the last time you blinked the LED previousMillis = _currentMillis; // if the LED is off turn it on and vice-versa: if (ledState == LOW) { if (ritmo[contRitmo] == 1) { noteOn(cmd, _noteRan, velocity); } contRitmo++; ledState = HIGH; } else { noteOn(cmd, _noteRan, 0x00); ledState = LOW; } // set the LED with the ledState of the variable: digitalWrite(ledPin, ledState); } } // plays a MIDI note. Doesn't check to see that cmd is greater than 127, or that // data values are less than 127: void noteOn(int _cmd, int _pitch, int _velocity) { Serial.write(_cmd); Serial.write(_pitch); Serial.write(_velocity); }
26.252137
110
0.629497
true
1,896
2695811c0dba308337bffc839b36e5157de17877
8,045
ino
Arduino
src/ESP32_NTP.ino
PuceBaboon/ESP32_W5500_NTP_CLIENT
e1a8e7c0ed1d007a74b99508d5a99aecafebc8f4
[ "Unlicense" ]
29
2019-04-05T14:29:34.000Z
2022-03-30T20:26:30.000Z
src/ESP32_NTP.ino
PuceBaboon/ESP32_W5500_NTP_CLIENT
e1a8e7c0ed1d007a74b99508d5a99aecafebc8f4
[ "Unlicense" ]
null
null
null
src/ESP32_NTP.ino
PuceBaboon/ESP32_W5500_NTP_CLIENT
e1a8e7c0ed1d007a74b99508d5a99aecafebc8f4
[ "Unlicense" ]
14
2019-11-10T16:00:12.000Z
2022-02-21T14:34:56.000Z
/* * $Id: ESP32_NTP.ino,v 1.8 2019/04/04 04:48:23 gaijin Exp $ * * UDP NTP client example program. * * Get the time from a Network Time Protocol (NTP) time server * Demonstrates use of UDP sendPacket and ReceivePacket * * Created: 04 Sep 2010 by Michael Margolis * Modified: 09 Apr 2012 by Tom Igoe * Modified: 02 Sep 2015 by Arturo Guadalupi * Munged: 04 Apr 2019 by PuceBaboon (for the ESP32 with a W5500 module) * */ #include <SPI.h> #include <Ethernet.h> #include <EthernetUdp.h> #include "local_config.h" // <--- Change settings for YOUR network here. const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message. byte packetBuffer[NTP_PACKET_SIZE]; // Buffer for both incoming and outgoing packets. // A UDP instance to let us send and receive packets over UDP. EthernetUDP Udp; /* * Wiz W5500 reset function. Change this for the specific reset * sequence required for your particular board or module. */ void WizReset() { Serial.print("Resetting Wiz W5500 Ethernet Board... "); pinMode(RESET_P, OUTPUT); digitalWrite(RESET_P, HIGH); delay(250); digitalWrite(RESET_P, LOW); delay(50); digitalWrite(RESET_P, HIGH); delay(350); Serial.println("Done."); } /* * This is a crock. It's here in an effort * to help people debug hardware problems with * their W5100 ~ W5500 board setups. It's * a copy of the Ethernet library enums and * should, at the very least, be regenerated * from Ethernet.h automatically before the * compile starts (that's a TODO item). * */ /* * Print the result of the hardware status enum * as a string. * Ethernet.h currently contains these values:- * * enum EthernetHardwareStatus { * EthernetNoHardware, * EthernetW5100, * EthernetW5200, * EthernetW5500 * }; * */ void prt_hwval(uint8_t refval) { switch (refval) { case 0: Serial.println("No hardware detected."); break; case 1: Serial.println("WizNet W5100 detected."); break; case 2: Serial.println("WizNet W5200 detected."); break; case 3: Serial.println("WizNet W5500 detected."); break; default: Serial.println ("UNKNOWN - Update espnow_gw.ino to match Ethernet.h"); } } /* * Print the result of the ethernet connection * status enum as a string. * Ethernet.h currently contains these values:- * * enum EthernetLinkStatus { * Unknown, * LinkON, * LinkOFF * }; * */ void prt_ethval(uint8_t refval) { switch (refval) { case 0: Serial.println("Uknown status."); break; case 1: Serial.println("Link flagged as UP."); break; case 2: Serial.println("Link flagged as DOWN. Check cable connection."); break; default: Serial.println ("UNKNOWN - Update espnow_gw.ino to match Ethernet.h"); } } void setup() { Serial.begin(115200); delay(500); Serial.println("\n\tUDP NTP Client v3.0\r\n"); // Use Ethernet.init(pin) to configure the CS pin. Ethernet.init(5); // GPIO5 on the ESP32. WizReset(); /* * Network configuration - all except the MAC are optional. * * IMPORTANT NOTE - The mass-produced W5500 boards do -not- * have a built-in MAC address (depite * comments to the contrary elsewhere). You * -must- supply a MAC address here. */ Serial.println("Starting ETHERNET connection..."); Ethernet.begin(eth_MAC, eth_IP, eth_DNS, eth_GW, eth_MASK); delay(200); Serial.print("Ethernet IP is: "); Serial.println(Ethernet.localIP()); /* * Sanity checks for W5500 and cable connection. */ Serial.print("Checking connection."); bool rdy_flag = false; for (uint8_t i = 0; i <= 20; i++) { if ((Ethernet.hardwareStatus() == EthernetNoHardware) || (Ethernet.linkStatus() == LinkOFF)) { Serial.print("."); rdy_flag = false; delay(80); } else { rdy_flag = true; break; } } if (rdy_flag == false) { Serial.println ("\n\r\tHardware fault, or cable problem... cannot continue."); Serial.print("Hardware Status: "); prt_hwval(Ethernet.hardwareStatus()); Serial.print(" Cable Status: "); prt_ethval(Ethernet.linkStatus()); while (true) { delay(10); // Halt. } } else { Serial.println(" OK"); } Udp.begin(localPort); } void loop() { sendNTPpacket(timeServer); // Send an NTP packet to the time server. // Wait to see if a reply is available. delay(1000); if (Udp.parsePacket()) { // We've received a packet, read the data from it. Udp.read(packetBuffer, NTP_PACKET_SIZE); // Read the packet into the buffer. // The timestamp starts at byte 40 of the received packet and is four bytes, // or two words, long. First, extract the two words. unsigned long highWord = word(packetBuffer[40], packetBuffer[41]); unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]); // Next, combine the four bytes (two words) into a long integer. // This is NTP time (seconds since Jan 1 1900). unsigned long secsSince1900 = highWord << 16 | lowWord; Serial.print("Seconds since Jan 1 1900 = "); Serial.println(secsSince1900); // Now convert NTP time into everyday time. Serial.print("Unix time = "); // Unix time starts on Jan 1 1970. In seconds, that's 2208988800. const unsigned long seventyYears = 2208988800UL; // Subtract seventy years. unsigned long epoch = secsSince1900 - seventyYears; // ...and then print Unix time. Serial.println(epoch); // Print the hour, minute and second. Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT). Serial.print((epoch % 86400L) / 3600); // Print the hour (86400 equals secs per day). Serial.print(':'); if (((epoch % 3600) / 60) < 10) { // For the first 10 minutes of each hour, insert a leading '0' character. Serial.print('0'); } Serial.print((epoch % 3600) / 60); // Print the minute (3600 equals secs per minute). Serial.print(':'); if ((epoch % 60) < 10) { // For the first 10 seconds of each minute, insert a leading '0' character. Serial.print('0'); } Serial.println(epoch % 60); // Print the second. } // Wait for a while before asking for the time again. Serial.print("Sleeping: "); for (uint8_t i = 0; i < SLEEP_SECS; i++) { delay(1000); // One second delay "ticks". Serial.print("."); } Serial.println("\n\r---\n\r"); // You only need to call maintain if you're using DHCP. // Ethernet.maintain(); } // Send an NTP request to the time server at the given address (defined in local_conf.h). void sendNTPpacket(const char *address) { // Set all bytes in the buffer to 0. memset(packetBuffer, 0, NTP_PACKET_SIZE); // Initialize values needed to form NTP request // (see http://en.wikipedia.org/wiki/Network_Time_Protocol). packetBuffer[0] = 0b11100011; // LI, Version, Mode packetBuffer[1] = 0; // Stratum, or type of clock packetBuffer[2] = 6; // Polling Interval packetBuffer[3] = 0xEC; // Peer Clock Precision // 8 bytes of zero for Root Delay & Root Dispersion packetBuffer[12] = 49; packetBuffer[13] = 0x4E; packetBuffer[14] = 49; packetBuffer[15] = 52; // All NTP fields have been given values, now // send a packet requesting a timestamp. Udp.beginPacket(address, 123); // NTP requests are to port 123 Udp.write(packetBuffer, NTP_PACKET_SIZE); Udp.endPacket(); }
30.823755
98
0.609074
true
2,088
c150ddcca230b644e41c920ed38940c935699755
521
ino
Arduino
src/Arduino/nano/nano.ino
isammour/LUCT
c239e3e470bfea71e747833f8bba763e55ef7611
[ "Apache-2.0" ]
4
2018-10-06T16:59:47.000Z
2018-10-09T18:17:48.000Z
src/Arduino/nano/nano.ino
isammour/LUCT
c239e3e470bfea71e747833f8bba763e55ef7611
[ "Apache-2.0" ]
null
null
null
src/Arduino/nano/nano.ino
isammour/LUCT
c239e3e470bfea71e747833f8bba763e55ef7611
[ "Apache-2.0" ]
0
null
null
#include <SPI.h> #include "RF24.h" RF24 myRadio ( 9,10); byte addresses[][6] = {"1Node"}; int dataTransmitted; void setup() { pinMode(0,INPUT); delay(1000); myRadio.begin(); myRadio.setChannel(108); myRadio.setPALevel(RF24_PA_MIN); myRadio.openWritingPipe( addresses[0]); delay(1000); } void loop() {int a=analogRead(a); if(a<650) dataTransmitted=1; else dataTransmitted=0; myRadio.write( &dataTransmitted, sizeof(dataTransmitted) ); // Transmit the data delay(500); }
15.323529
83
0.65643
true
168
2985a902bdf62ffe13b9256f05dcf9cf6b77b10e
581
ino
Arduino
Prototype1/software/encoder_interrupt_test/encoder_interrupt_test.ino
barrystaes/Stoommachine-Aircontrol
77494faf1369416588a5cf42373d5f0ff38fb410
[ "ISC" ]
1
2019-07-29T14:37:35.000Z
2019-07-29T14:37:35.000Z
Prototype1/software/encoder_interrupt_test/encoder_interrupt_test.ino
barrystaes/Stoommachine-Aircontrol
77494faf1369416588a5cf42373d5f0ff38fb410
[ "ISC" ]
null
null
null
Prototype1/software/encoder_interrupt_test/encoder_interrupt_test.ino
barrystaes/Stoommachine-Aircontrol
77494faf1369416588a5cf42373d5f0ff38fb410
[ "ISC" ]
0
null
null
// 20150208 Barry: // Initial version based on https://www.youtube.com/watch?v=0QLZCfqUeg4 // Interrupt information // 0 on pin 2 // 1 on pin 3 #define encoderI 2 #define encoderQ 4 // Only use one interrupt in this example volatile int count; void setup() { Serial.begin(115200); count=0;e pinMode(encoderI, INPUT); pinMode(encoderQ, INPUT); attachInterrupt(0, handleEncoder, CHANGE); } void loop() { Serial.println(count); delay(100); } void handleEncoder() { if(digitalRead(encoderI) == digitalRead(encoderQ)) { count++; } else { count--; } }
18.741935
73
0.678141
true
168
58b638eb6d2b16f47e5a53bc2b14174925342b32
2,935
ino
Arduino
libraries/WiFiEsp/examples/UdpSendReceive/UdpSendReceive.ino
popemadmitch/ESP-1ch-Gateway-v5.0
7724a2dad61af2c320ee35ee696297088cc16a61
[ "MIT" ]
260
2017-11-19T05:34:42.000Z
2020-02-18T15:13:15.000Z
libraries/WiFiEsp/examples/UdpSendReceive/UdpSendReceive.ino
popemadmitch/ESP-1ch-Gateway-v5.0
7724a2dad61af2c320ee35ee696297088cc16a61
[ "MIT" ]
95
2017-12-05T08:10:30.000Z
2020-02-29T18:25:44.000Z
libraries/WiFiEsp/examples/UdpSendReceive/UdpSendReceive.ino
popemadmitch/ESP-1ch-Gateway-v5.0
7724a2dad61af2c320ee35ee696297088cc16a61
[ "MIT" ]
130
2017-11-22T13:20:16.000Z
2020-02-25T05:40:39.000Z
/* WiFiEsp example: WiFi UDP Send and Receive String This sketch wait an UDP packet on localPort using a WiFi shield. When a packet is received an 'ACK' packet is sent to the client on port remotePort. For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-client.html */ #include <WiFiEsp.h> #include <WiFiEspUdp.h> // Emulate Serial1 on pins 6/7 if not present #ifndef HAVE_HWSERIAL1 #include "SoftwareSerial.h" SoftwareSerial Serial1(6, 7); // RX, TX #endif char ssid[] = "Twim"; // your network SSID (name) char pass[] = "12345678"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status unsigned int localPort = 10002; // local port to listen on char packetBuffer[255]; // buffer to hold incoming packet char ReplyBuffer[] = "ACK"; // a string to send back WiFiEspUDP Udp; void setup() { // initialize serial for debugging Serial.begin(115200); // initialize serial for ESP module Serial1.begin(9600); // initialize ESP module WiFi.init(&Serial1); // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); // don't continue: while (true); } // attempt to connect to WiFi network while ( status != WL_CONNECTED) { Serial.print("Attempting to connect to WPA SSID: "); Serial.println(ssid); // Connect to WPA/WPA2 network status = WiFi.begin(ssid, pass); } Serial.println("Connected to wifi"); printWifiStatus(); Serial.println("\nStarting connection to server..."); // if you get a connection, report back via serial: Udp.begin(localPort); Serial.print("Listening on port "); Serial.println(localPort); } void loop() { // if there's data available, read a packet int packetSize = Udp.parsePacket(); if (packetSize) { Serial.print("Received packet of size "); Serial.println(packetSize); Serial.print("From "); IPAddress remoteIp = Udp.remoteIP(); Serial.print(remoteIp); Serial.print(", port "); Serial.println(Udp.remotePort()); // read the packet into packetBufffer int len = Udp.read(packetBuffer, 255); if (len > 0) { packetBuffer[len] = 0; } Serial.println("Contents:"); Serial.println(packetBuffer); // send a reply, to the IP address and port that sent us the packet we received Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); Udp.write(ReplyBuffer); Udp.endPacket(); } } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); // print the received signal strength: long rssi = WiFi.RSSI(); Serial.print("signal strength (RSSI):"); Serial.print(rssi); Serial.println(" dBm"); }
26.681818
85
0.670869
true
742
752e9a591adc7f57524580debfd0b60e51503aca
10,951
ino
Arduino
ESP32 or TinyPICO/EzTimeTetrisClockESP32/EzTimeTetrisClockESP32.ino
Anwaarullah/WiFi-Tetris-Clock
b3f5e0550e85e3bc041bae48d36c1211e7c68b89
[ "MIT" ]
null
null
null
ESP32 or TinyPICO/EzTimeTetrisClockESP32/EzTimeTetrisClockESP32.ino
Anwaarullah/WiFi-Tetris-Clock
b3f5e0550e85e3bc041bae48d36c1211e7c68b89
[ "MIT" ]
null
null
null
ESP32 or TinyPICO/EzTimeTetrisClockESP32/EzTimeTetrisClockESP32.ino
Anwaarullah/WiFi-Tetris-Clock
b3f5e0550e85e3bc041bae48d36c1211e7c68b89
[ "MIT" ]
0
null
null
/******************************************************************* Tetris clock that fetches its time Using the EzTimeLibrary For use with the ESP32 or TinyPICO * * Written by Brian Lough YouTube: https://www.youtube.com/brianlough Tindie: https://www.tindie.com/stores/brianlough/ Twitter: https://twitter.com/witnessmenow *******************************************************************/ // ---------------------------- // Standard Libraries - Already Installed if you have ESP32 set up // ---------------------------- #include <WiFi.h> // ---------------------------- // Additional Libraries - each one of these will need to be installed. // ---------------------------- // Enabling this is meant to have a performance // improvement but its worse for me. // https://github.com/2dom/PxMatrix/pull/103 //#define double_buffer #include <PxMatrix.h> // The library for controlling the LED Matrix // At time of writing this my changes for the TinyPICO // Have been merged into the main PxMatrix library, // but have not been released, so you will need to install // from Github // // If you are using a regular ESP32 you may be able to use // the library manager version // https://github.com/2dom/PxMatrix // Adafruit GFX library is a dependancy for the PxMatrix Library // Can be installed from the library manager // https://github.com/adafruit/Adafruit-GFX-Library #include <TetrisMatrixDraw.h> // This library draws out characters using a tetris block // amimation // Can be installed from the library manager // https://github.com/toblum/TetrisAnimation #include <ezTime.h> // Library used for getting the time and adjusting for DST // Search for "ezTime" in the Arduino Library manager // https://github.com/ropg/ezTime // ---- Stuff to configure ---- // Initialize Wifi connection to the router char ssid[] = "AP NAME"; // your network SSID (name) char password[] = "yourcoolpassword"; // your network key // Set a timezone using the following list // https://en.wikipedia.org/wiki/List_of_tz_database_time_zones #define MYTIMEZONE "Asia/Kolkata" // Sets whether the clock should be 12 hour format or not. bool twelveHourFormat = true; // If this is set to false, the number will only change if the value behind it changes // e.g. the digit representing the least significant minute will be replaced every minute, // but the most significant number will only be replaced every 10 minutes. // When true, all digits will be replaced every minute. bool forceRefresh = false; // ----------------------------- // ----- Wiring ------- #define P_LAT 22 #define P_A 19 #define P_B 23 #define P_C 18 #define P_D 5 #define P_E 15 //#define P_OE 26 //TinyPICO //#define P_OE 21 //Huzzah32 #define P_OE 2 // Generic ESP32 // --------------------- portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; hw_timer_t * timer = NULL; hw_timer_t * animationTimer = NULL; // PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C); PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D); // I'm using a P4 64x32 Matrix //PxMATRIX display(64, 32, P_LAT, P_OE, P_A, P_B, P_C, P_D, P_E); TetrisMatrixDraw tetris(display); // Main clock TetrisMatrixDraw tetris2(display); // The "M" of AM/PM TetrisMatrixDraw tetris3(display); // The "P" or "A" of AM/PM TetrisMatrixDraw tetris4(display); // Date Timezone myTZ; unsigned long oneSecondLoopDue = 0; bool showColon = true; volatile bool finishedAnimating = false; bool displayIntro = true; String lastDisplayedTime = ""; String lastDisplayedAmPm = ""; // This method is needed for driving the display void IRAM_ATTR display_updater() { portENTER_CRITICAL_ISR(&timerMux); display.display(30); portEXIT_CRITICAL_ISR(&timerMux); } // This method is for controlling the tetris library draw calls void animationHandler() { #ifndef double_buffer portENTER_CRITICAL_ISR(&timerMux); #endif // Not clearing the display and redrawing it when you // dont need to improves how the refresh rate appears if (!finishedAnimating) { #ifdef double_buffer display.fillScreen(tetris.tetrisBLACK); #else display.clearDisplay(); #endif //display.fillScreen(tetris.tetrisBLACK); if (displayIntro) { finishedAnimating = tetris.drawText(1, 21); } else { if (twelveHourFormat) { // Place holders for checking are any of the tetris objects // currently still animating. bool tetris1Done = false; bool tetris2Done = false; bool tetris3Done = false; bool tetris4Done = false; tetris4Done = tetris4.drawText(1, 31); tetris2Done = tetris2.drawText(56, 20); // Only draw the top letter once the bottom letter is finished. if (tetris4Done) { tetris1Done = tetris.drawNumbers(-6, 21, showColon); } if (tetris2Done) { tetris3Done = tetris3.drawText(56, 10); } finishedAnimating = tetris1Done && tetris2Done && tetris3Done; } else { finishedAnimating = tetris.drawNumbers(2, 21, showColon); } } #ifdef double_buffer display.showBuffer(); #endif } #ifndef double_buffer portEXIT_CRITICAL_ISR(&timerMux); #endif } void drawIntro(int x = 0, int y = 0) { tetris.drawChar("P", x, y, tetris.tetrisCYAN); tetris.drawChar("o", x + 5, y, tetris.tetrisMAGENTA); tetris.drawChar("w", x + 11, y, tetris.tetrisYELLOW); tetris.drawChar("e", x + 17, y, tetris.tetrisGREEN); tetris.drawChar("r", x + 22, y, tetris.tetrisBLUE); tetris.drawChar("e", x + 27, y, tetris.tetrisRED); tetris.drawChar("d", x + 32, y, tetris.tetrisWHITE); tetris.drawChar(" ", x + 37, y, tetris.tetrisMAGENTA); tetris.drawChar("b", x + 42, y, tetris.tetrisYELLOW); tetris.drawChar("y", x + 47, y, tetris.tetrisGREEN); } void drawConnecting(int x = 0, int y = 0) { tetris.drawChar("C", x, y, tetris.tetrisCYAN); tetris.drawChar("o", x + 5, y, tetris.tetrisMAGENTA); tetris.drawChar("n", x + 11, y, tetris.tetrisYELLOW); tetris.drawChar("n", x + 17, y, tetris.tetrisGREEN); tetris.drawChar("e", x + 22, y, tetris.tetrisBLUE); tetris.drawChar("c", x + 27, y, tetris.tetrisRED); tetris.drawChar("t", x + 32, y, tetris.tetrisWHITE); tetris.drawChar("i", x + 37, y, tetris.tetrisMAGENTA); tetris.drawChar("n", x + 42, y, tetris.tetrisYELLOW); tetris.drawChar("g", x + 47, y, tetris.tetrisGREEN); } void setup() { Serial.begin(115200); // Attempt to connect to Wifi network: Serial.print("Connecting Wifi: "); Serial.println(ssid); // Set WiFi to station mode and disconnect from an AP if it was Previously // connected WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(""); Serial.println("WiFi connected"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); // Do not set up display before WiFi connection // as it will crash! // Intialise display library //display.begin(16, SPI_BUS_CLK, 27, SPI_BUS_MISO, SPI_BUS_SS); // TinyPICO display.begin(16); // Generic ESP32 including Huzzah display.flushDisplay(); // Setup timer for driving display timer = timerBegin(0, 80, true); timerAttachInterrupt(timer, &display_updater, true); timerAlarmWrite(timer, 2000, true); timerAlarmEnable(timer); yield(); #ifdef double_buffer display.fillScreen(tetris.tetrisBLACK); #else display.clearDisplay(); #endif // "connecting" drawConnecting(5, 10); #ifdef double_buffer display.showBuffer(); #endif // Setup EZ Time setDebug(INFO); waitForSync(); Serial.println(); Serial.println("UTC: " + UTC.dateTime()); myTZ.setLocation(F(MYTIMEZONE)); Serial.print(F("Time in your set timezone: ")); Serial.println(myTZ.dateTime()); #ifdef double_buffer display.fillScreen(tetris.tetrisBLACK); #else display.clearDisplay(); #endif // "Powered By" drawIntro(6, 12); #ifdef double_buffer display.showBuffer(); #endif delay(2000); // Start the Animation Timer tetris.setText("TINY PICO"); animationTimer = timerBegin(1, 80, true); timerAttachInterrupt(animationTimer, &animationHandler, true); timerAlarmWrite(animationTimer, 15000, true); timerAlarmEnable(animationTimer); // Wait for the animation to finish while (!finishedAnimating) { delay(10); //waiting for intro to finish } delay(2000); finishedAnimating = false; displayIntro = false; tetris.scale = 2; } void setMatrixTime() { String timeString = ""; String AmPmString = ""; String dateString = ""; if (twelveHourFormat) { // Get the time in format "1:15" or 11:15 (12 hour, no leading 0) // Check the EZTime Github page for info on // time formatting timeString = myTZ.dateTime("g:i"); //If the length is only 4, pad it with // a space at the beginning if (timeString.length() == 4) { timeString = " " + timeString; } //Get if its "AM" or "PM" AmPmString = myTZ.dateTime("A"); dateString = myTZ.dateTime("j/M/y"); // Get the Date String dateString.toUpperCase(); if (lastDisplayedAmPm != AmPmString) { Serial.println(AmPmString); lastDisplayedAmPm = AmPmString; // Second character is always "M" // so need to parse it out tetris2.setText("M", forceRefresh); // Parse out first letter of String tetris3.setText(AmPmString.substring(0, 1), forceRefresh); tetris4.setText(dateString, forceRefresh); } } else { // Get time in format "01:15" or "22:15"(24 hour with leading 0) timeString = myTZ.dateTime("H:i"); } // Only update Time if its different if (lastDisplayedTime != timeString) { Serial.println(timeString); lastDisplayedTime = timeString; tetris.setTime(timeString, forceRefresh); // Must set this to false so animation knows // to start again finishedAnimating = false; } } void handleColonAfterAnimation() { // It will draw the colon every time, but when the colour is black it // should look like its clearing it. uint16_t colour = showColon ? tetris.tetrisWHITE : tetris.tetrisBLACK; // The x position that you draw the tetris animation object int x = twelveHourFormat ? -6 : 2; // The y position adjusted for where the blocks will fall from // (this could be better!) int y = 21 - (TETRIS_Y_DROP_DEFAULT * tetris.scale); tetris.drawColon(x, y, colour); } void loop() { unsigned long now = millis(); if (now > oneSecondLoopDue) { // We can call this often, but it will only // update when it needs to setMatrixTime(); showColon = !showColon; // To reduce flicker on the screen we stop clearing the screen // when the animation is finished, but we still need the colon to // to blink if (finishedAnimating) { handleColonAfterAnimation(); } oneSecondLoopDue = now + 1000; } }
30.251381
90
0.665145
true
2,979
86f903a82a8266ec25eff6c0cc2d5a927b2da862
966
ino
Arduino
examples/SimpleRxAckPayload/SimpleRxAckPayload.ino
shenkarSElab/nanoRF
6a57dbca206dd470f8ee8d12eeb9567dd6f8035c
[ "Unlicense" ]
null
null
null
examples/SimpleRxAckPayload/SimpleRxAckPayload.ino
shenkarSElab/nanoRF
6a57dbca206dd470f8ee8d12eeb9567dd6f8035c
[ "Unlicense" ]
1
2016-10-24T18:37:35.000Z
2016-10-25T18:23:31.000Z
examples/SimpleRxAckPayload/SimpleRxAckPayload.ino
shenkarSElab/nano24rf
6a57dbca206dd470f8ee8d12eeb9567dd6f8035c
[ "Unlicense" ]
1
2021-06-07T02:59:42.000Z
2021-06-07T02:59:42.000Z
// SimpleRxAckPayload- the slave or the receiver #include "switchPin.h" //https://github.com/fredlllll/FredUtil-Arduino/blob/master/fredOptimization.h #define FLASH_PIN 4 #define GND_PIN 5 //also mosfet #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #define CE_PIN 7 #define CSN_PIN 8 const byte thisSlaveAddress[5] = {'R', 'x', 'A', 'Z', 'A'}; RF24 radio(CE_PIN, CSN_PIN); char dataReceived[1]; // this must match dataToSend in the TX //============== #define DEBUG 0 void setup() { Serial.begin(115200); Serial.println("RX..."); pinMode(FLASH_PIN, OUTPUT); pinMode(GND_PIN, OUTPUT); digitalWrite(GND_PIN, LOW); radio.begin(); radio.setAutoAck(0); radio.openReadingPipe(1, thisSlaveAddress); radio.startListening(); } //========== void loop() { if ( radio.available() ) { Serial.println("got"); switchOn<FLASH_PIN>(); radio.read( &dataReceived, sizeof(dataReceived) ); switchOff<FLASH_PIN>(); } }
17.888889
78
0.662526
true
275
0803f5fa534c65aceb42aaf33a9b507d97175b99
14,497
ino
Arduino
src/suitchi/suitchi.ino
amd989/Suitchi
e8a83fc83a7942cb0212fb19fb56d4a7e1d246b9
[ "MIT" ]
null
null
null
src/suitchi/suitchi.ino
amd989/Suitchi
e8a83fc83a7942cb0212fb19fb56d4a7e1d246b9
[ "MIT" ]
1
2021-06-13T02:00:59.000Z
2021-06-23T14:34:49.000Z
src/suitchi/suitchi.ino
amd989/Suitchi
e8a83fc83a7942cb0212fb19fb56d4a7e1d246b9
[ "MIT" ]
1
2021-04-07T17:08:23.000Z
2021-04-07T17:08:23.000Z
/* * suitchi.ino * * Created on: 2020-12-01 * Author: amd989 (Alejandro Mora) This code represents a bridge (aka gateway) which contains multiple accessories. This includes 6 sensors: 1. Temperature Sensor (HAP section 8.41) 2. Humidity Sensor (HAP section 8.20) 4. Motion Sensor (HAP section 8.28) 5. Occupancy Sensor (HAP section 8.29) 6. Switch (HAP section 8.38) You should: 1. erase the full flash or call homekit_storage_reset() in setup() to remove the previous HomeKit pairing storage and enable the pairing with the new accessory of this new HomeKit example. */ #include <Arduino.h> #include <arduino_homekit_server.h> #include "wifi_info.h" #include "custom_fonts.h" #include "ESPButton.h" #include "Constants.h" // Include the UI lib #include "SSD1306Brzo.h" #include "OLEDDisplayUi.h" #include <DHT.h> #include <ArduinoOTA.h> #include <SimpleTimer.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <ESP8266mDNS.h> #include <WiFiUdp.h> #define LOG_D(fmt, ...) printf_P(PSTR(fmt "\n") , ##__VA_ARGS__); ////////////////////////// // Setting up the pin and DHT version #define DHTTYPE DHT11 // DHT Shield uses DHT 11 #define RELAYPIN D8 // Relay Shield uses pin D0 #define OCCUPANCYPIN D3 // Occupancy uses pin D3 #define DHTPIN D4 // DHT Shield uses pin D4 #define SWITCHPIN D7 // Relay Shield uses pin D7 // Initialize the OLED display using Arduino Wire: SSD1306Brzo display(0x3c, SDA, SCL, GEOMETRY_64_48 ); // ADDRESS, SDA, SCL //OLEDDisplayUi ui ( &display ); DHT dht(DHTPIN, DHTTYPE); // Listen for HTTP requests on standard port 80 ESP8266WebServer server(80); //Sensor variables float humidity, temperature, hindex; // Raw float values from the sensor char str_humidity[10], str_temperature[10], str_hindex[10]; // Rounded sensor values as strings bool occupancy, motion = false; int motionState = 0; // current state of the motion sensor int lastMotionState = 0; // previous state of the motion sensor // Generally, you should use "unsigned long" for variables that hold time unsigned long previousMillis = 0; // When the sensor was last read const long interval = 2000; // Wait this long until reading again // countdown variables and timer const int CountdownTime = 60; // Time to wait until occupancy is turned off. int CountdownTimer; SimpleTimer occupancyTimer; // this timer is used to shut off the occupancy after a certain ammount of time void(* resetFunc) (void) = 0; // declare reset fuction at address 0 //Sets up the initial page void handle_root() { server.send(200, "text/plain", "Welcome to Suitchi Web Server."); delay(100); } void setup() { Serial.begin(115200); Serial.println("Starting..."); Serial.println("Setup DHT..."); dht.begin(); Serial.println("Setup UI..."); // Initialising the UI will init the display too. display.init(); display.flipScreenVertically(); display.setContrast(255); display.setFont(ArialMT_Plain_10); drawFrame0(&display, 0, 0); Serial.println("Setup WiFi..."); wifi_connect(); // in wifi_info.h Serial.println("Setup Timers..."); // Setup occupancy timer CountdownTimer = occupancyTimer.setInterval(CountdownTime * 1000L, CountdownTimerFunction); occupancyTimer.disable(CountdownTimer); Serial.println("Setup OTA..."); // For OTA - Use your own device identifying name (in Constants.h) ArduinoOTA.setHostname(otaName); ArduinoOTA.onStart([]() { String type; if (ArduinoOTA.getCommand() == U_FLASH) { type = "sketch"; } else { // U_FS type = "filesystem"; } // NOTE: if updating FS this would be the place to unmount FS using FS.end() Serial.println("Start updating " + type); }); ArduinoOTA.begin(); ArduinoOTA.onStart([]() { display.clear(); display.setFont(ArialMT_Plain_10); display.setTextAlignment(TEXT_ALIGN_CENTER_BOTH); display.drawString(display.getWidth() / 2, display.getHeight() / 2 - 10, "OTA Update"); display.display(); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { display.drawProgressBar(0, 32, 63, 8, progress / (total / 100) ); display.display(); }); ArduinoOTA.onEnd([]() { display.clear(); display.setFont(ArialMT_Plain_10); display.setTextAlignment(TEXT_ALIGN_CENTER_BOTH); display.drawString(display.getWidth() / 2, display.getHeight() / 2, "Restart"); display.display(); }); Serial.println("Setup Web Server..."); // Handle http request display root server.on("/", HTTP_GET, handle_root); // Handle http requests display temp+hum value server.on("/TH", []() { read_sensor(); char response[50]; snprintf(response, 50, "{ \"Temperature\": %s, \"Humidity\" : %s }", str_temperature, str_humidity); server.send(200, "application/json", response); }); // Handle http requests display temp+hum value server.on("/motion", []() { char response[55]; snprintf(response, 55, "{ \"Motion\": %s, \"Occupancy\" : %s }", motion ? "1" : "0", occupancy ? "1" : "0"); server.send(200, "application/json", response); }); // Handle http requests display temp+hum value server.on("/status", []() { char response[55]; snprintf(response, 55, "{ \"Heap\": %d, \"Clients\" : %d }", ESP.getFreeHeap(), arduino_homekit_connected_clients_count()); server.send(200, "application/json", response); }); // Start the web server server.begin(); Serial.println("Setup Homekit..."); //homekit_storage_reset(); // to remove the previous HomeKit pairing storage when you first run this HomeKit sketch my_homekit_setup(); Serial.println("Startup Complete."); } // This array keeps function pointers to all frames // frames are the single views that slide in // FrameCallback frames[] = { drawFrame1 }; // how many frames are there? // int frameCount = 1; // Overlays are statically drawn on top of a frame eg. a clock OverlayCallback overlays[] = { }; int overlaysCount = 0; void loop() { ArduinoOTA.handle(); occupancyTimer.run(); server.handleClient(); ESPButton.loop(); read_sensor(); delay(10); my_homekit_loop(); delay(10); drawFrame1(&display, 0, 0); } //============================== // HomeKit setup and loop //============================== extern "C" homekit_server_config_t config; extern "C" homekit_characteristic_t cha_temperature; extern "C" homekit_characteristic_t cha_humidity; extern "C" homekit_characteristic_t cha_switch_on; extern "C" homekit_characteristic_t cha_motion; extern "C" homekit_characteristic_t cha_occupancy; #define HOMEKIT_OCCUPANCY_DETECTED 1 #define HOMEKIT_OCCUPANCY_NOT_DETECTED 0 #define HOMEKIT_PROGRAMMABLE_SWITCH_EVENT_SINGLE_PRESS 0 #define HOMEKIT_PROGRAMMABLE_SWITCH_EVENT_DOUBLE_PRESS 1 #define HOMEKIT_PROGRAMMABLE_SWITCH_EVENT_LONG_PRESS 2 // Called when the value is read by iOS Home APP homekit_value_t cha_switch_on_getter() { // Should always return "null" for reading, see HAP section 9.75 return HOMEKIT_NULL_CPP(); } //Called when the switch value is changed by iOS Home APP void cha_switch_on_setter(const homekit_value_t value) { bool on = value.bool_value; cha_switch_on.value.bool_value = on; //sync the value LOG_D("Switch: %s", on ? "ON" : "OFF"); digitalWrite(RELAYPIN, on ? HIGH : LOW); } void read_sensor() { // read the occupancy input: motionState = digitalRead(OCCUPANCYPIN); if (motionState != lastMotionState) { if (motionState == HIGH) { // Report Occupancy occupancy = true; motion = true; LOG_D("Motion: %s", motion ? "ON" : "OFF"); cha_motion.value.bool_value = motion; homekit_characteristic_notify(&cha_motion, cha_motion.value); cha_occupancy.value.uint8_value = (uint8_t)occupancy; homekit_characteristic_notify(&cha_occupancy, cha_occupancy.value); occupancyTimer.disable(CountdownTimer); occupancyTimer.enable(CountdownTimer); } else { motion = false; LOG_D("Motion: %s", motion ? "ON" : "OFF"); } // Delay a little bit to avoid bouncing delay(50); } // save the current state as the last state, for next time through the loop lastMotionState = motionState; // Wait at least 2 seconds seconds between measurements. // If the difference between the current time and last time you read // the sensor is bigger than the interval you set, read the sensor. // Works better than delay for things happening elsewhere also. unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { // Save the last time you read the sensor previousMillis = currentMillis; // Reading temperature and humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor) humidity = dht.readHumidity(); // Read humidity as a percent temperature = dht.readTemperature(); // Read temperature as Celsius // Check if any reads failed and exit early (to try again). if (isnan(humidity) || isnan(temperature)) { Serial.println("Failed to read from DHT sensor!"); return; } hindex = dht.computeHeatIndex(temperature, humidity, false); // Read temperature as Celsius // Convert the floats to strings and round to 2 decimal places dtostrf(hindex, 1, 2, str_hindex); dtostrf(humidity, 1, 2, str_humidity); dtostrf(temperature, 1, 2, str_temperature); } } void my_homekit_setup() { pinMode(RELAYPIN, OUTPUT); // Set the relay output up pinMode(OCCUPANCYPIN, INPUT); // Set the occupancy input up pinMode(SWITCHPIN, INPUT_PULLUP); // Set the switch input up digitalWrite(RELAYPIN, LOW); // Turn Relay Off ESPButton.add(0, SWITCHPIN, LOW, true, true); ESPButton.setCallback([&](uint8_t id, ESPButtonEvent event) { // Only one button is added, no need to check the id. LOG_D("Button Event: %s", ESPButton.getButtonEventDescription(event)); if (event == ESPBUTTONEVENT_SINGLECLICK) { bool switchValue = !cha_switch_on.value.bool_value; cha_switch_on.value.bool_value = switchValue; // sync the value digitalWrite(RELAYPIN, switchValue ? HIGH : LOW); LOG_D("Switch: %s", switchValue ? "ON" : "OFF"); homekit_characteristic_notify(&cha_switch_on, cha_switch_on.value); } else if (event == ESPBUTTONEVENT_DOUBLECLICK) { } else if (event == ESPBUTTONEVENT_LONGCLICK) { drawFrame0(&display, 0, 0); homekit_storage_reset(); // to remove the previous HomeKit pairing storage delay(1000); Serial.println("Restarting..."); resetFunc(); //call reset } }); ESPButton.begin(); //Add the .setter function to get the switch-event sent from iOS Home APP. //The .setter should be added before arduino_homekit_setup. //HomeKit sever uses the .setter_ex internally, see homekit_accessories_init function. //Maybe this is a legacy design issue in the original esp-homekit library, //and I have no reason to modify this "feature". cha_switch_on.setter = cha_switch_on_setter; // cha_switch_on.getter = cha_switch_on_getter; arduino_homekit_setup(&config); } static uint32_t next_heap_millis = 0; static uint32_t next_report_millis = 0; void my_homekit_loop() { arduino_homekit_loop(); const uint32_t t = millis(); if (t >= next_report_millis) { // report sensor values every 2 seconds next_report_millis = t + 10 * 1000; my_homekit_report(); } if (t >= next_heap_millis) { // Show heap info every 5 seconds next_heap_millis = t + 5 * 1000; LOG_D("Free heap: %d, HomeKit clients: %d", ESP.getFreeHeap(), arduino_homekit_connected_clients_count()); } } void my_homekit_report() { // Report Motion cha_motion.value.bool_value = motion; homekit_characteristic_notify(&cha_motion, cha_motion.value); // Report Occupancy cha_occupancy.value.uint8_value = (uint8_t)occupancy; homekit_characteristic_notify(&cha_occupancy, cha_occupancy.value); // Report Switch homekit_characteristic_notify(&cha_switch_on, cha_switch_on.value); if (!(isnan(humidity) || isnan(temperature)) && (humidity < 100 || temperature < 50)) { float t = temperature; float h = humidity; // Report Temperature cha_temperature.value.float_value = t; homekit_characteristic_notify(&cha_temperature, cha_temperature.value); // Report Humidity cha_humidity.value.float_value = h; homekit_characteristic_notify(&cha_humidity, cha_humidity.value); } LOG_D("t %.1f, h %.1f, m %u, o %u", temperature, humidity, (uint8_t)motion, (uint8_t)occupancy); } void CountdownTimerFunction() { //Serial.print("Countdown function called "); // Report Occupancy occupancy = false; motion = false; cha_motion.value.bool_value = motion; homekit_characteristic_notify(&cha_motion, cha_motion.value); cha_occupancy.value.uint8_value = (uint8_t)occupancy; homekit_characteristic_notify(&cha_occupancy, cha_occupancy.value); occupancyTimer.disable(CountdownTimer); // stop timer } void drawFrame0(SSD1306Brzo *display, int16_t x, int16_t y) { display->clear(); display->setFont(ArialMT_Plain_10); display->drawString(10 + x, 18 + y, "Starting..."); display->display(); } void drawFrame1(SSD1306Brzo *display, int16_t x, int16_t y) { // converts to int removing unnecessary decimal points int hAsInt = int(humidity); int iAsInt = int(hindex); int tAsInt = int(temperature); display->clear(); display->drawLine(40 + x, 2 + y, 40 + x, 45 + y); display->drawLine(44 + x, 23 + y, 63 + x, 23 + y); display->setFont(ArialMT_Plain_16); display->drawString(0 + x, 2 + y, String(tAsInt) + "°C"); display->setFont(ArialMT_Plain_10); display->drawString(0 + x, 18 + y, "H:" + String(hAsInt) + "%"); display->drawString(0 + x, 30 + y, "I:" + String(iAsInt) + "°C"); display->setFont(Icons_16); display->drawString(47 + x, 4 + y, String((uint8_t)occupancy)); display->drawString(47 + x, 28 + y, cha_switch_on.value.bool_value ? "3" : "2"); display->display(); } void drawFrame2(SSD1306Brzo *display, int16_t x, int16_t y) { display->clear(); display->setFont(ArialMT_Plain_10); display->drawString(10 + x, 17 + y, "Resetting..."); display->display(); }
33.635731
127
0.685383
true
3,840
1c03e28deb784fd517fbe80cf923a0c0d7e2e88f
41,690
ino
Arduino
examples/ReflowWizard/Reflow.ino
engineertype/Controleo3
76404dde356d32f53dbd56d96584679f8278034c
[ "MIT" ]
93
2017-09-09T00:47:52.000Z
2022-02-25T17:27:26.000Z
examples/ReflowWizard/Reflow.ino
engineertype/Controleo3
76404dde356d32f53dbd56d96584679f8278034c
[ "MIT" ]
17
2017-09-11T07:04:49.000Z
2021-10-06T06:53:22.000Z
examples/ReflowWizard/Reflow.ino
engineertype/Controleo3
76404dde356d32f53dbd56d96584679f8278034c
[ "MIT" ]
41
2017-09-11T07:03:04.000Z
2022-01-11T20:58:10.000Z
// Written by Peter Easton // Released under the MIT license // Build a reflow oven: https://whizoo.com #define BUTTON_DONE 0 #define BUTTON_STOP 1 // Graph location and size #define GRAPH_TOP 145 #define GRAPH_LEFT 45 #define GRAPH_HEIGHT 150 #define GRAPH_WIDTH 300 #define CLOSE_LOG_FILE if (logFileOpen) { logFile.close(); logFileOpen = false; } // Perform a reflow // Stay in this function until the reflow is done or canceled void reflow(uint8_t profileNo) { uint32_t reflowTimer = 0, countdownTimer = 0, plotSeconds = 0, secondsFromStart = 0, lastLoopTime = millis(); uint8_t counter = 0; uint8_t reflowPhase = REFLOW_PHASE_NEXT_COMMAND; double currentTemperature = 0, pidTemperatureDelta = 0, pidTemperature = 0; uint8_t elementDutyCounter[NUMBER_OF_OUTPUTS]; boolean isOneSecondInterval = false, displayGraph = false; uint16_t iconsX, i, token = NOT_A_TOKEN, numbers[4], maxDuty[4], currentDuty[4], bias[4]; boolean isPID = false, incrementTimer = true; boolean abortDialogIsOnScreen = false, logFileOpen = false; uint16_t maxTemperatureDeviation = 20, maxTemperature = 260, desiredTemperature = 0, Kd, maxBias; int16_t pidPower; float pidPreviousError = 0, pidIntegral = 0, pidDerivative, thisError; uint16_t graphMaxTemp = 0, graphMaxSeconds = 0; File logFile; // Verify the outputs are configured if (areOutputsConfigured() == false) { showHelp(HELP_OUTPUTS_NOT_CONFIGURED); return; } // Make sure learning has completed if (prefs.learningComplete == LEARNING_NOT_DONE) { showHelp(HELP_LEARNING_NOT_DONE); return; } // Is SD card logging of time/temperature enabled? if (prefs.logToSDCard) { // Is the SD card inserted? if (digitalRead(A0) == HIGH) { showHelp(HELP_NO_SD_CARD); return; } // Open the log file on the SD card // Try initializing twice. Necessary if good card follows bad one if (!SD.begin() && !SD.begin()) { showHelp(HELP_BAD_FORMAT); return; } SerialUSB.println("SD Card initialized"); // Open the log file sprintf(buffer100Bytes, "Log%05d.csv", prefs.logNumber); logFile = SD.open(buffer100Bytes, FILE_WRITE); if (!logFile) { SerialUSB.println("Unable to open logging file " + String(buffer100Bytes)); showHelp(HELP_CANT_WRITE_TO_SD_CARD); return; } // Log file has been successfully opened. Write the name of the profile to the log file logFileOpen = true; SerialUSB.println("Opened logging file " + String(buffer100Bytes)); logFile.println(prefs.profile[profileNo].name); // Increment the file number (we don't care about wrap-around from 65536 to 0) prefs.logNumber++; savePrefs(); } SerialUSB.println("Running profile: " + String(prefs.profile[profileNo].name)); SerialUSB.println("Power=" + String(prefs.learnedPower) + " Inertia=" + String(prefs.learnedInertia) + " Insulation=" + String(prefs.learnedInsulation)); // Calculate the centered position of the heating and fan icons (icons are 32x32) iconsX = 240 - (numOutputsConfigured() * 20) + 4; // (2*20) - 32 = 8. 8/2 = 4 // Stagger the element start cycle to avoid abrupt changes in current draw // Simple method: there are 6 outputs but the first ones are likely the heating elements for (i=0; i< NUMBER_OF_OUTPUTS; i++) elementDutyCounter[i] = (65 * i) % 100; // Default the maximum duty cycles for the elements. These values can be overwritten by the profile file maxDuty[TYPE_BOTTOM_ELEMENT] = 100; maxDuty[TYPE_TOP_ELEMENT] = 75; maxDuty[TYPE_BOOST_ELEMENT] = 60; // Default the current duty cycles for the elements. currentDuty[TYPE_BOTTOM_ELEMENT] = 0; currentDuty[TYPE_TOP_ELEMENT] = 0; currentDuty[TYPE_BOOST_ELEMENT] = 0; // Default the bias for the elements. These values can be overwritten by the profile file bias[TYPE_BOTTOM_ELEMENT] = 100; bias[TYPE_TOP_ELEMENT] = 80; bias[TYPE_BOOST_ELEMENT] = 50; maxBias = 100; // Set up the flash reads to start with the first block of this profile if (getNextTokenFromFlash(0, &prefs.profile[profileNo].startBlock) == TOKEN_END_OF_PROFILE) { CLOSE_LOG_FILE; return; } // Default the title to the old "Reflow" (the title can be overwritten in the profile) eraseHeader(); displayHeader((char *) "Reflow", false); // Ug, hate goto's! But this saves a lot of extraneous code. userChangedMindAboutAborting: // Erase the bottom part of the screen tft.fillRect(0, 100, 480, 230, WHITE); // Setup the STOP/DONE tap targets on this screen drawStopDoneButton(displayGraph, BUTTON_STOP); // Display the graph, if user chose to display it if (displayGraph) drawGraphOutline(graphMaxTemp, graphMaxSeconds); // Toggle the baking temperature between C/F if the user taps in the top-right corner setTouchTemperatureUnitChangeCallback(0); // Display the status (if waiting) updateStatusMessage(token, countdownTimer, desiredTemperature, abortDialogIsOnScreen); // Debounce any taps that took us to this screen debounce(); // Keep looping until reflow is done while (1) { // Waiting for the user to tap the screen? if (reflowPhase == REFLOW_WAITING_FOR_TAP && touch.isPressed()) { updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); playTones(TUNE_BUTTON_PRESSED); quickDebounce(); reflowPhase = REFLOW_PHASE_NEXT_COMMAND; } // Has there been a touch? switch (getTap(CHECK_FOR_TAP_THEN_EXIT)) { case 0: // If reflow is done (or user taps "stop" in Abort dialog) then clean up and return to the main menu if (reflowPhase >= REFLOW_ALL_DONE || abortDialogIsOnScreen) { reflowPhase = REFLOW_ABORT; // Make sure we exit this screen as soon as possible lastLoopTime = millis() - 20; counter = 40; } else { // User tapped to abort the reflow drawReflowAbortDialog(); abortDialogIsOnScreen = true; } break; default: // The user didn't tap the screen, but if the Abort dialog is up and the phase makes // it irrelevant then automatically dismiss it now // You never know, maybe the cat tapped "Stop" ... if (!abortDialogIsOnScreen || reflowPhase < REFLOW_ALL_DONE) break; // Intentional fall-through (simulate user tapped Cancel) ... case 1: // This is the cancel button of the Abort dialog. User wants to continue // Erase the Abort dialog abortDialogIsOnScreen = false; counter = 0; // Redraw the screen under the dialog goto userChangedMindAboutAborting; } // Execute this loop every 20ms (50 times per second) if (millis() - lastLoopTime < 20) { delay(1); continue; } lastLoopTime += 20; // Try not to update everything in the same 20ms time slice // Update the temperature if (counter == 1) displayTemperatureInHeader(); // Dump data to the debugging port if (counter == 5 && reflowPhase != REFLOW_ALL_DONE) DumpDataToUSB(reflowTimer, currentTemperature, 0, 0); // Update the reflow timer if (counter == 10 && !abortDialogIsOnScreen) displayReflowDuration(reflowTimer, displayGraph); // Log data to the SD card if (counter == 20 && logFileOpen) { sprintf(buffer100Bytes, "%ld,%d.%02d", secondsFromStart, (uint16_t) currentTemperature, (uint16_t) ((currentTemperature - (uint16_t) currentTemperature) * 100)); logFile.println(buffer100Bytes); // Flush the buffer (write to SD card) frequenty to prevent stutters when writing big blocks of data logFile.flush(); } // Determine if this is on a 1-second interval isOneSecondInterval = false; if (++counter >= 50) { counter = 0; isOneSecondInterval = true; if (countdownTimer) countdownTimer--; if (incrementTimer && reflowPhase < REFLOW_ALL_DONE) reflowTimer++; plotSeconds++; secondsFromStart++; } // Read the current temperature currentTemperature = getCurrentTemperature(); if (IS_MAX31856_ERROR(currentTemperature)) { switch ((int) currentTemperature) { case FAULT_OPEN: strcpy(buffer100Bytes, "Fault open (disconnected)"); break; case FAULT_VOLTAGE: strcpy(buffer100Bytes, "Over/under voltage (wrong type?)"); break; case NO_MAX31856: // Should never happen unless MAX31856 is broken strcpy(buffer100Bytes, "MAX31856 error"); break; } // Abort the reflow SerialUSB.println("Thermocouple error:" + String(buffer100Bytes)); SerialUSB.println("Profile aborted because of thermocouple error!"); showReflowError(iconsX, (char *) "Thermocouple error:", buffer100Bytes); reflowPhase = REFLOW_ABORT; } // Was the maximum temperature exceeded? if (currentTemperature > maxTemperature && reflowPhase != REFLOW_PHASE_NEXT_COMMAND) { // Open the oven door to cool things off setServoPosition(prefs.servoOpenDegrees, 3000); // Abort the reflow SerialUSB.println("Profile aborted because of maximum temperature exceeded!"); sprintf(buffer100Bytes, "Maximum temperature of %d~C", maxTemperature); showReflowError(iconsX, buffer100Bytes, (char *) "was exceeded."); reflowPhase = REFLOW_ABORT; } switch (reflowPhase) { case REFLOW_PHASE_NEXT_COMMAND: // Get the next token from flash, and act on it token = getNextTokenFromFlash(buffer100Bytes, numbers); if (token != TOKEN_DISPLAY && token != TOKEN_TITLE) SerialUSB.println(tokenToText(buffer100Bytes, token, numbers)); switch (token) { case TOKEN_DISPLAY: // Erase the text that was there and display the text from the profile tft.fillRect(20, LINE(1), 459, 24, WHITE); displayString(20, LINE(1), FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); break; case TOKEN_TITLE: // Erase the text that was there and display the text from the profile eraseHeader(); displayHeader(buffer100Bytes, false); break; case TOKEN_MAX_DUTY: // Overwrite the default max duty cycles of the elements (max is 100%) maxDuty[TYPE_BOTTOM_ELEMENT] = numbers[0] < 100? numbers[0]: 100; maxDuty[TYPE_TOP_ELEMENT] = numbers[1] < 100? numbers[1]: 100; maxDuty[TYPE_BOOST_ELEMENT] = numbers[2] < 100? numbers[2]: 100; break; case TOKEN_ELEMENT_DUTY_CYCLES: // Force a specific duty cycle on the elements. This turns off PID currentDuty[TYPE_BOTTOM_ELEMENT] = numbers[0] < 100? numbers[0]: 100; currentDuty[TYPE_TOP_ELEMENT] = numbers[1] < 100? numbers[1]: 100; currentDuty[TYPE_BOOST_ELEMENT] = numbers[2] < 100? numbers[2]: 100; // Make sure the maximum duty cycles hasn't been exceeded for (i = TYPE_BOTTOM_ELEMENT; i <= TYPE_BOOST_ELEMENT; i++) { if (currentDuty[i] > maxDuty[i]) currentDuty[i] = maxDuty[i]; } // Turn PID temperature control off. The user wants these specific values to be used isPID = false; break; case TOKEN_BIAS: // Specify a bottom/top/boost temperature bias // They cannot all be zero if ((numbers[0] + numbers[1] + numbers[2]) == 0) break; bias[TYPE_BOTTOM_ELEMENT] = numbers[0]; bias[TYPE_TOP_ELEMENT] = numbers[1]; bias[TYPE_BOOST_ELEMENT] = numbers[2]; // Figure out the high number for bias. For example, 90/60/30 could also be expressed as 3/2/1 maxBias = 0; for (i = TYPE_BOTTOM_ELEMENT; i <= TYPE_BOOST_ELEMENT; i++) { if (bias[i] > maxBias) maxBias = bias[i]; } break; case TOKEN_DEVIATION: // Specify the delta between the target temperature and current temperature which if exceeded will // cause abort. This is only used when running PID. maxTemperatureDeviation = constrain(numbers[0], 1, 100); break; case TOKEN_MAX_TEMPERATURE: // Specify the maximum temperature the oven isn't allowed to exceed maxTemperature = numbers[0]; break; case TOKEN_INITIALIZE_TIMER: // Update the on-screen timer and logging timer with this new value reflowTimer = numbers[0]; incrementTimer = true; break; case TOKEN_START_TIMER: incrementTimer = true; break; case TOKEN_STOP_TIMER: incrementTimer = false; break; case TOKEN_OVEN_DOOR_OPEN: // Open the oven door over X seconds numbers[0] = numbers[0] < 30? numbers[0]: 30; setServoPosition(prefs.servoOpenDegrees, numbers[0] * 1000); break; case TOKEN_OVEN_DOOR_CLOSE: // Close the oven door over X seconds numbers[0] = numbers[0] < 30? numbers[0]: 30; setServoPosition(prefs.servoClosedDegrees, numbers[0] * 1000); break; case TOKEN_OVEN_DOOR_PERCENT: // Open the oven door a certain percentage numbers[0] = numbers[0] < 100? numbers[0]: 100; numbers[1] = numbers[1] < 30? numbers[1]: 30; setServoPosition(map(numbers[0], 0, 100, prefs.servoClosedDegrees, prefs.servoOpenDegrees), numbers[1] * 1000); break; case TOKEN_WAIT_FOR_SECONDS: // Keep the oven in this state for a number of seconds // PID shouldn't be on now. TOKEN_ELEMENT_DUTY_CYCLES should've been specified if (isPID) { SerialUSB.println("ERROR: Must specify \"element duty cycle\" before \"wait for\"!"); isPID = false; // Assume elements should be off currentDuty[TYPE_BOTTOM_ELEMENT] = 0; currentDuty[TYPE_TOP_ELEMENT] = 0; currentDuty[TYPE_BOOST_ELEMENT] = 0; } countdownTimer = numbers[0]; reflowPhase = REFLOW_WAITING_FOR_TIME; updateStatusMessage(token, countdownTimer, 0, abortDialogIsOnScreen); break; case TOKEN_WAIT_UNTIL_ABOVE_C: // Wait until the oven temperature is above a certain temperature // PID shouldn't be on now. TOKEN_ELEMENT_DUTY_CYCLES should've been specified if (isPID) { SerialUSB.println("ERROR: Must specify \"element duty cycle\" before \"wait until above\"!"); isPID = false; // Assume elements should be off currentDuty[TYPE_BOTTOM_ELEMENT] = 0; currentDuty[TYPE_TOP_ELEMENT] = 0; currentDuty[TYPE_BOOST_ELEMENT] = 0; } desiredTemperature = numbers[0]; if (desiredTemperature >= maxTemperature) { // This is a problem because the reflow will abort as soon as this temperature is reached SerialUSB.println("ERROR: wait-until-temp higher than maximum temperature!"); desiredTemperature = maxTemperature; } reflowPhase = REFLOW_WAITING_UNTIL_ABOVE; updateStatusMessage(token, 0, desiredTemperature, abortDialogIsOnScreen); break; case TOKEN_WAIT_UNTIL_BELOW_C: // PID shouldn't be on now. TOKEN_ELEMENT_DUTY_CYCLES should've been specified if (isPID) { SerialUSB.println("ERROR: Must specify \"element duty cycle\" before \"wait until below\"!"); isPID = false; // Assume elements should be off currentDuty[TYPE_BOTTOM_ELEMENT] = 0; currentDuty[TYPE_TOP_ELEMENT] = 0; currentDuty[TYPE_BOOST_ELEMENT] = 0; } // Wait until the oven temperature is above a certain temperature desiredTemperature = numbers[0]; if (desiredTemperature < 25) { // This is a problem because the temperature is below room temperature SerialUSB.println("ERROR: wait-until-temp lower than room temperature!"); desiredTemperature = 25; } reflowPhase = REFLOW_WAITING_UNTIL_BELOW; updateStatusMessage(token, 0, desiredTemperature, abortDialogIsOnScreen); break; case TOKEN_MAINTAIN_TEMP: // Save the parameters pidTemperature = numbers[0]; countdownTimer = numbers[1] > 0? numbers[1] : 1; updateStatusMessage(token, countdownTimer, pidTemperature, abortDialogIsOnScreen); desiredTemperature = pidTemperature; reflowPhase = REFLOW_MAINTAIN_TEMP; // The temperature control is now done using PID isPID = true; pidTemperatureDelta = 0; // Initialize the PID variables pidPreviousError = 0; pidIntegral = 0; break; case TOKEN_SHOW_GRAPH: // Graph the reflow displayGraph = true; graphMaxTemp = numbers[0] > 100? numbers[0] : 100; graphMaxSeconds = numbers[1] > 100? numbers[1] : 100; // Don't start plotting until the "start plotting" command plotSeconds = graphMaxSeconds + 1; // Draw the graph UI goto userChangedMindAboutAborting; break; case TOKEN_GRAPH_DIVIDER: if (displayGraph) { // Calculate where the line must be uint16_t ypos = GRAPH_TOP + GRAPH_HEIGHT - (GRAPH_HEIGHT * ((float) numbers[0]/(float) graphMaxTemp)); ypos = constrain(ypos, GRAPH_TOP, GRAPH_TOP + GRAPH_HEIGHT); // Draw the line tft.drawFastHLine(GRAPH_LEFT+2, ypos, GRAPH_WIDTH-2, GREEN); } break; case TOKEN_START_PLOTTING: // Start plotting time / temperature plotSeconds = numbers[0]; SerialUSB.println("Starting to plot"); break; case TOKEN_CONVECTION_FAN_ON: // Turn on the convection fan turnConvectionFanOn(true); break; case TOKEN_CONVECTION_FAN_OFF: // Turn off the convection fan turnConvectionFanOn(false); break; case TOKEN_COOLING_FAN_ON: // Turn on the cooling fan turnCoolingFanOn(true); break; case TOKEN_COOLING_FAN_OFF: // Turn off the cooling fan turnCoolingFanOn(false); break; case TOKEN_PLAY_DONE_TUNE: // Play a tune to let the user know reflow is done playTones(TUNE_REFLOW_DONE); break; case TOKEN_PLAY_BEEP: // Play a tune to let the user know reflow is done playTones(TUNE_REFLOW_BEEP); break; case TOKEN_TEMPERATURE_TARGET: // Save the parameters desiredTemperature = numbers[0]; countdownTimer = numbers[1] > 0? numbers[1] : 1; updateStatusMessage(token, countdownTimer, desiredTemperature, abortDialogIsOnScreen); // The temperature control is now done using PID isPID = true; // Calculate a straight line between the current temperature and the desired end temperature pidTemperatureDelta = (desiredTemperature - currentTemperature) / countdownTimer; // Start the PID temperature at the current temperature pidTemperature = currentTemperature; // Initialize the PID variables pidPreviousError = 0; pidIntegral = 0; reflowPhase = REFLOW_PID; break; case TOKEN_TAP_SCREEN: updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); updateStatusMessage(token, 0, 0, abortDialogIsOnScreen); reflowPhase = REFLOW_WAITING_FOR_TAP; break; case TOKEN_END_OF_PROFILE: // The end of the profile has been reached. Reflow is done // Change the STOP button to DONE drawStopDoneButton(displayGraph, BUTTON_DONE); reflowPhase = REFLOW_ALL_DONE; // One more reflow completed! prefs.numReflows++; savePrefs(); } // If the reflow timer isn't ticking, execute the next command quickly if (!reflowTimer) lastLoopTime = millis() - 20; break; case REFLOW_WAITING_FOR_TIME: // Make changes every second if (!isOneSecondInterval) break; // Update the time left updateStatusMessage(token, countdownTimer, 0, abortDialogIsOnScreen); // We were waiting for a certain period of time. Have we waited long enough? if (countdownTimer == 0) { SerialUSB.println("Finished waiting"); // Erase the status updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); // Get the next command reflowPhase = REFLOW_PHASE_NEXT_COMMAND; } break; case REFLOW_WAITING_UNTIL_ABOVE: // Make changes every second if (!isOneSecondInterval) break; // We were waiting for the oven temperature to rise above a certain point if (currentTemperature >= desiredTemperature) { SerialUSB.println("Heated to desired temperature"); // Erase the status updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); // Get the next command reflowPhase = REFLOW_PHASE_NEXT_COMMAND; } break; case REFLOW_WAITING_UNTIL_BELOW: // Make changes every second if (!isOneSecondInterval) break; // We were waiting for the oven temperature to drop below a certain point if (currentTemperature <= desiredTemperature) { SerialUSB.println("Cooled to desired temperature"); // Erase the status updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); // Get the next command reflowPhase = REFLOW_PHASE_NEXT_COMMAND; } break; case REFLOW_MAINTAIN_TEMP: // Make changes every second if (!isOneSecondInterval) break; // We were waiting for a certain period of time. Have we waited long enough? if (countdownTimer == 0) { SerialUSB.println("Finished maintaining temperature"); // Erase the status updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); // Get the next command reflowPhase = REFLOW_PHASE_NEXT_COMMAND; break; } // Is the oven over the desired temperature? if (currentTemperature >= desiredTemperature) { // Turn all the elements off currentDuty[TYPE_BOTTOM_ELEMENT] = 0; currentDuty[TYPE_TOP_ELEMENT] = 0; currentDuty[TYPE_BOOST_ELEMENT] = 0; // Update the countdown timer updateStatusMessage(token, countdownTimer, desiredTemperature, abortDialogIsOnScreen); // Reset the PID variables pidIntegral = 0; pidPreviousError = 0; break; } // Intentional fall-through if under temperature ... case REFLOW_PID: // Make changes every second if (!isOneSecondInterval) break; // Has the desired temperature been reached? Go to the next phase then // The PID phase terminates when the temperature is reached, not when the // timer reaches zero. if (currentTemperature > desiredTemperature) { // Erase the status updateStatusMessage(NOT_A_TOKEN, 0, 0, abortDialogIsOnScreen); // Get the next command reflowPhase = REFLOW_PHASE_NEXT_COMMAND; break; } // Calculate what the expected temperature should be at this point pidTemperature += pidTemperatureDelta; // Abort if deviated too far from the required temperature if (reflowPhase == REFLOW_PID && abs(pidTemperature - currentTemperature) > maxTemperatureDeviation && pidTemperature < desiredTemperature) { // Open the oven door setServoPosition(prefs.servoOpenDegrees, 3000); SerialUSB.println("ERROR: temperature delta exceeds maximum allowed!"); sprintf(buffer100Bytes, "Exceeded max deviation of %d~C.", maxTemperatureDeviation); sprintf(buffer100Bytes+50, "Target = %d~C, actual = %d~C", (int) pidTemperature, (int) currentTemperature); showReflowError(iconsX, buffer100Bytes, buffer100Bytes+50); reflowPhase = REFLOW_ALL_DONE; break; } // Assume a certain power level, based on the current temperature and the rate-of-rise // This should be fairly accurate, and is based on the learned values pidPower = getBasePIDPower(pidTemperature, pidTemperatureDelta, bias, maxBias); // Do the PID calculation now. The base power will be adjusted a bit based on this result // This is the standard PID formula, using a 1-second interval thisError = pidTemperature - currentTemperature; pidIntegral = pidIntegral + thisError; pidDerivative = thisError - pidPreviousError; pidPreviousError = thisError; // The black magic of PID tuning! // Compared to most other closed-loop systems, reflow ovens are slow to respond to input, so the derivative term is the // most important one. The other terms are assigned lower weights. // Kp = 2. This says that if the temperature is 5 degrees too low, the power should be increased by 10%. This doesn't // sound like much (and it isn't) but heating elements are slow to heat up and cool down, so this is reasonable. // Ki = 0.01. This is a very small number. It basically says that if we're under-temperature for a very long time then // increase the power to the elements a tiny amount. Having this any higher will create oscillations. // Kd is based on the learned inertia value and for the typical reflow oven it should be around 35. Some resistive // elements take a very long time to heat up and cool down so this will be a much higher value. Kd = map(constrain(prefs.learnedInertia, 30, 100), 30, 100, 30, 75); // Dump these values out over USB for debugging SerialUSB.println("T="+String(currentTemperature)+" P="+String(pidTemperature)+" D="+String(pidTemperatureDelta)+" E="+String(thisError)+" I="+String(pidIntegral)+" D="+String(pidDerivative)+" Kd="+String(Kd)); // If we're over-temperature, it is best to slow things down even more since taking a bit longer in a phase is better than taking less time if (thisError < 0) thisError = 4 * thisError + 0.01 * pidIntegral + Kd * pidDerivative; else thisError = 2 * thisError + 0.01 * pidIntegral + Kd * pidDerivative; // The base power we calculated first should be close to the required power, but allow the PID value to adjust // this up or down a bit. The effect PID has on the outcome is deliberately limited because moving between zero // (elements off) and 100 (full power) will create hot and cold spots. PID can move the power by 60%; 30% down or up. thisError = constrain(thisError, -30, 30); // Add the base power and the PID delta SerialUSB.println("Power was " + String(pidPower) + " and is now " + String(pidPower + thisError)); pidPower += (thisError); // Make sure the resulting power is reasonable pidPower = constrain(pidPower, 0, 100); // Determine the duty cycle of each element based on the top/bottom/boost bias currentDuty[TYPE_TOP_ELEMENT] = pidPower * bias[TYPE_TOP_ELEMENT] / maxBias; currentDuty[TYPE_BOTTOM_ELEMENT] = pidPower * bias[TYPE_BOTTOM_ELEMENT] / maxBias; currentDuty[TYPE_BOOST_ELEMENT] = pidPower * bias[TYPE_BOOST_ELEMENT] / maxBias; // Make sure none of the max duty cycles are exceeded for (i = TYPE_BOTTOM_ELEMENT; i <= TYPE_BOOST_ELEMENT; i++) { if (currentDuty[i] > maxDuty[i]) currentDuty[i] = maxDuty[i]; } // Update the countdown timer updateStatusMessage(token, countdownTimer, desiredTemperature, abortDialogIsOnScreen); break; case REFLOW_ALL_DONE: // Nothing to do here. Just waiting for user to tap the screen CLOSE_LOG_FILE; break; case REFLOW_ABORT: // User either tapped "Done" at the end of the reflow, or the user tapped abort setOvenOutputs(ELEMENTS_OFF, CONVECTION_FAN_OFF, COOLING_FAN_OFF); // Close the oven door setServoPosition(prefs.servoClosedDegrees, 1000); // Stop logging CLOSE_LOG_FILE; // All done! return; } // Turn the outputs on or off based on the duty cycle for (i=0; i< NUMBER_OF_OUTPUTS; i++) { switch (prefs.outputType[i]) { case TYPE_TOP_ELEMENT: // Turn the output on at 0, and off at the duty cycle value if (elementDutyCounter[i] == 0 && currentDuty[TYPE_TOP_ELEMENT] > 0) setOutput(i, HIGH); // Turn it off at the right duty cycle if (elementDutyCounter[i] >= currentDuty[TYPE_TOP_ELEMENT]) setOutput(i, LOW); break; case TYPE_BOTTOM_ELEMENT: // Turn the output on at 0, and off at the duty cycle value if (elementDutyCounter[i] == 0 && currentDuty[TYPE_BOTTOM_ELEMENT] > 0) setOutput(i, HIGH); // Turn it off at the right duty cycle if (elementDutyCounter[i] >= currentDuty[TYPE_BOTTOM_ELEMENT]) setOutput(i, LOW); break; case TYPE_BOOST_ELEMENT: // Turn the output on at 0, and off at the duty cycle value if (elementDutyCounter[i] == 0 && currentDuty[TYPE_BOOST_ELEMENT] > 0) setOutput(i, HIGH); // Turn it off at the right duty cycle if (elementDutyCounter[i] >= currentDuty[TYPE_BOOST_ELEMENT]) setOutput(i, LOW); break; } // Increment the duty counter elementDutyCounter[i] = (elementDutyCounter[i] + 1) % 100; } // Add data to the graph plot if (isOneSecondInterval && !abortDialogIsOnScreen && displayGraph) { // Does this data point need to be plotted? if (plotSeconds > 0 && plotSeconds < graphMaxSeconds) { // Calculate the x and y positions of this point uint16_t xpos = GRAPH_LEFT + (((float) plotSeconds)/((float) graphMaxSeconds)) * GRAPH_WIDTH; uint16_t ypos = GRAPH_TOP + GRAPH_HEIGHT - (GRAPH_HEIGHT * ((float) currentTemperature/(float) graphMaxTemp)); // Allow the temperature to go over the top of the graph, just a bit ypos = constrain(ypos, GRAPH_TOP - 6, GRAPH_TOP + GRAPH_HEIGHT - 1); xpos = constrain(xpos, GRAPH_LEFT + 1, GRAPH_LEFT + GRAPH_WIDTH - 1); tft.fillRect(xpos - 1, ypos - 1, 3, 3, RED); } } animateIcons(iconsX); } // end of big while loop } // Draw the STOP/DONE button on the screen void drawStopDoneButton(boolean isGraphDisplayed, boolean buttonIsStop) { clearTouchTargets(); if (isGraphDisplayed) { // Draw the button tft.fillRect(368, 247, 94, 26, WHITE); drawButton(352, 230, 126, buttonIsStop? 87: 93, BUTTON_LARGE_FONT, buttonIsStop? (char *) "STOP" : (char *) "DONE"); // Define the tap target (as large as possible) defineTouchArea(320, 200, 160, 120); } else { // Draw the button tft.fillRect(194, 247, 94, 26, WHITE); drawButton(110, 230, 260, buttonIsStop? 87: 93, BUTTON_LARGE_FONT, buttonIsStop? (char *) "STOP" : (char *) "DONE"); // Define the tap target (as large as possible) defineTouchArea(20, 150, 440, 170); } } // Draw the abort dialog on the screen. The user needs to confirm that they want to exit reflow void drawReflowAbortDialog() { drawThickRectangle(0, 100, 480, 220, 10, RED); tft.fillRect(10, 110, 460, 200, WHITE); displayString(126, 116, FONT_12PT_BLACK_ON_WHITE, (char *) "Stop Running"); displayString(54, 157, FONT_9PT_BLACK_ON_WHITE, (char *) "Are you sure you want to stop?"); clearTouchTargets(); drawTouchButton(60, 232, 160, 74, BUTTON_LARGE_FONT, (char *) "Stop"); drawTouchButton(260, 232, 160, 105, BUTTON_LARGE_FONT, (char *) "Cancel"); } void updateStatusMessage(uint16_t token, uint16_t timer, uint16_t temperature, boolean abortDialogIsOnScreen) { uint16_t strLength; static uint8_t numberLength = 0; // Don't do anything if the abort dialog is on the screen if (abortDialogIsOnScreen) return; // Erase the area where the status message is displayed if (token == NOT_A_TOKEN) { tft.fillRect(20, LINE(2), 459, 24, WHITE); numberLength = 0; } switch (token) { case TOKEN_WAIT_FOR_SECONDS: strLength = displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, (char *) "Waiting... "); sprintf(buffer100Bytes, "%d", timer); if (numberLength == 0) numberLength = strlen(buffer100Bytes); displayFixedWidthString(20+strLength, LINE(2), buffer100Bytes, numberLength, FONT_9PT_BLACK_ON_WHITE_FIXED); break; case TOKEN_WAIT_UNTIL_ABOVE_C: sprintf(buffer100Bytes, "Continue when oven is above %d~C", temperature); displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); break; case TOKEN_WAIT_UNTIL_BELOW_C: sprintf(buffer100Bytes, "Continue when oven is below %d~C", temperature); displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); break; case TOKEN_TEMPERATURE_TARGET: sprintf(buffer100Bytes, "Ramping oven to %d~C ... ", temperature); strLength = displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); sprintf(buffer100Bytes, "%d", timer); if (numberLength == 0) numberLength = strlen(buffer100Bytes); displayFixedWidthString(20+strLength, LINE(2), buffer100Bytes, numberLength, FONT_9PT_BLACK_ON_WHITE_FIXED); break; case TOKEN_MAINTAIN_TEMP: sprintf(buffer100Bytes, "Holding temperature at %d~C ... ", temperature); strLength = displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); sprintf(buffer100Bytes, "%d", timer); if (numberLength == 0) numberLength = strlen(buffer100Bytes); displayFixedWidthString(20+strLength, LINE(2), buffer100Bytes, numberLength, FONT_9PT_BLACK_ON_WHITE_FIXED); break; case TOKEN_TAP_SCREEN: displayString(20, LINE(2), FONT_9PT_BLACK_ON_WHITE, (char *) "Tap the screen to continue ..."); break; } } // Show an error dialog when an error forces reflow to be aborted void showReflowError(uint16_t iconsX, char *line1, char *line2) { uint32_t lastLoopTime = millis(), updateTemperatureInHeader = millis();; // Show the error on the screen drawThickRectangle(0, 90, 480, 230, 15, RED); tft.fillRect(15, 105, 450, 200, WHITE); displayString(196, 110, FONT_12PT_BLACK_ON_WHITE, (char *) "Error"); displayString(40, 150, FONT_9PT_BLACK_ON_WHITE, line1); displayString(40, 180, FONT_9PT_BLACK_ON_WHITE, line2); drawStopDoneButton(false, BUTTON_DONE); // Turn everything off except the fans setOvenOutputs(ELEMENTS_OFF, CONVECTION_FAN_ON, COOLING_FAN_ON); // Wait for the user to tap the screen do { // Animate the fan icons if (millis() - lastLoopTime >= 20) { animateIcons(iconsX); lastLoopTime += 20; } // Update the temperature in the header if (millis() - updateTemperatureInHeader >= 1000) { displayTemperatureInHeader(); updateTemperatureInHeader += 1000; } } while (getTap(CHECK_FOR_TAP_THEN_EXIT) == -1); } // Display the reflow timer void displayReflowDuration(uint32_t seconds, boolean isGraphDisplayed) { static uint16_t oldWidth = 1, timerX = 381; uint16_t newWidth; if (isGraphDisplayed) { newWidth = displayString(timerX, 170, FONT_12PT_BLACK_ON_WHITE_FIXED, secondsInClockFormat(buffer100Bytes, seconds)); // Keep the timer display centered if (newWidth != oldWidth) { // The width has changed (one more character on the display). Erase what was there tft.fillRect(timerX, 170, newWidth > oldWidth? newWidth : oldWidth, 25, WHITE); // Redraw the timer oldWidth = newWidth; timerX = 415 - (newWidth >> 1); // If timer can't be centered then right-justify it if (newWidth > 120) timerX = 475 - newWidth; displayString(timerX, 170, FONT_12PT_BLACK_ON_WHITE_FIXED, buffer100Bytes); } } else { // Center the timer for the "no graph" initialization case if (timerX == 381) timerX = 178; newWidth = displayString(timerX, 160, FONT_22PT_BLACK_ON_WHITE_FIXED, secondsInClockFormat(buffer100Bytes, seconds)); // Keep the timer display centered if (newWidth != oldWidth) { // The width has changed (one more character on the display). Erase what was there tft.fillRect(timerX, 160, newWidth > oldWidth? newWidth : oldWidth, 48, WHITE); // Redraw the timer oldWidth = newWidth; timerX = 240 - (newWidth >> 1); displayString(timerX, 160, FONT_22PT_BLACK_ON_WHITE_FIXED, buffer100Bytes); } } } // Calculate the expected power level based on the desired temperature and desired rate-of-rise uint16_t getBasePIDPower(double temperature, double increment, uint16_t *bias, uint16_t maxBias) { uint16_t basePower, insulationPower, risePower, totalBasePower; float biasFactor; temperature = constrain(temperature, 29, 250); // First, figure out the power required to maintain this temperature // Start by extrapolating the power using all elements at 120C // 120C = 100%, 150C = 125%, 200C = 166% basePower = temperature * 0.83 * prefs.learnedPower / 100; // Adjust this number slightly based on the expected losses through the insulation. Heat losses will be higher at high temperatures insulationPower = map(prefs.learnedInsulation, 0, 300, map(temperature, 0, 400, 0, 20), 0); // Adjust by the desired rate-of-rise risePower = increment * basePower * 2; // Adjust power by the bias, since some elements may receive less than the calculated power // Hope that the user hasn't made the boost element receive the most power - that isn't good. // Example, if top/bottom bias was 50/100 and power was 40%, then power should increase to 53.33% // as shown below // No bias: // top: bias @ 100% * power @ 40% ==> 40% // bottom: bias @ 100% * power @ 40% ==> 40% // average power: 40% + 40% / 2 ==> 40% // 50/100 top/bottom bias: // top: bias @50% * power @ 53.33% ==> 26.66% // bottom: bias @100% * power @ 53.33% ==> 53.33% // average power: 26.66% + 53.33% / 2 ==> 40% // // Actual calculation: // Bias factor = 2 / (Btop/Bmax + Bbottom/Bmax) = 2 * Bmax / (Btop + Bbottom) biasFactor = (float) 2 * maxBias / (bias[TYPE_BOTTOM_ELEMENT] + bias[TYPE_TOP_ELEMENT]); totalBasePower = basePower + insulationPower + risePower; SerialUSB.println("Base PID power at "+String(temperature)+"C: B="+String(basePower)+" I="+String(insulationPower)+" R="+String(risePower)+" Total="+String(totalBasePower)+" bias="+String(biasFactor)); // Put it all together totalBasePower = totalBasePower * biasFactor; return totalBasePower < 100? totalBasePower : 100; } // Draw the outline of the graph, including axis, labels and dividers void drawGraphOutline(uint16_t graphMaxTemp, uint16_t graphMaxSeconds) { // Y-axis (temperature) tft.drawFastVLine(GRAPH_LEFT, GRAPH_TOP, GRAPH_HEIGHT, BLACK); tft.drawFastVLine(GRAPH_LEFT+1, GRAPH_TOP, GRAPH_HEIGHT, BLACK); tft.drawFastVLine(GRAPH_LEFT + GRAPH_WIDTH / 2, GRAPH_TOP, GRAPH_HEIGHT, BLUE); tft.drawFastVLine(GRAPH_LEFT + GRAPH_WIDTH, GRAPH_TOP, GRAPH_HEIGHT, BLUE); sprintf(buffer100Bytes, "%d", graphMaxTemp); displayString(0, GRAPH_TOP - 5, FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); displayString(11, GRAPH_TOP -12 + GRAPH_HEIGHT / 2, FONT_9PT_BLACK_ON_WHITE, (char *) "~C"); displayString(28, GRAPH_TOP + GRAPH_HEIGHT - 7, FONT_9PT_BLACK_ON_WHITE, (char *) "0"); // X-axis (time) tft.drawFastHLine(GRAPH_LEFT, GRAPH_TOP, GRAPH_WIDTH, BLUE); tft.drawFastHLine(GRAPH_LEFT, GRAPH_TOP + GRAPH_HEIGHT / 2, GRAPH_WIDTH, BLUE); tft.drawFastHLine(GRAPH_LEFT, GRAPH_TOP + GRAPH_HEIGHT, GRAPH_WIDTH + 1, BLACK); tft.drawFastHLine(GRAPH_LEFT, GRAPH_TOP + GRAPH_HEIGHT + 1, GRAPH_WIDTH + 1, BLACK); displayString(GRAPH_LEFT - 40 + GRAPH_WIDTH / 2, 300, FONT_9PT_BLACK_ON_WHITE, (char *) "seconds"); sprintf(buffer100Bytes, "%d", graphMaxSeconds); displayString(GRAPH_LEFT - 40 + GRAPH_WIDTH, 300, FONT_9PT_BLACK_ON_WHITE, buffer100Bytes); }
42.111111
218
0.644783
true
10,415
bcad23d613e5e067ba05975dce06b68efe442b3a
653
ino
Arduino
examples/pca9685-lib-client/pca9685-lib-client.ino
adarshkumarsingh83/Pca9685-lib
72844727afd4b8a2f7604c7d8ac5c2164ea58b1d
[ "MIT" ]
1
2021-04-08T16:50:14.000Z
2021-04-08T16:50:14.000Z
examples/pca9685-lib-client/pca9685-lib-client.ino
adarshkumarsingh83/Pca9685-lib
72844727afd4b8a2f7604c7d8ac5c2164ea58b1d
[ "MIT" ]
null
null
null
examples/pca9685-lib-client/pca9685-lib-client.ino
adarshkumarsingh83/Pca9685-lib
72844727afd4b8a2f7604c7d8ac5c2164ea58b1d
[ "MIT" ]
0
null
null
#include "Pca9685Board.h" #define NO_OF_BOARDS 3 int MAX_PINS = 0; Pca9685Board pca9685Board; void setup() { Serial.begin(9600); pca9685Board.initPca9685Boards(NO_OF_BOARDS); MAX_PINS = NO_OF_BOARDS * 16; for (int i = 1; i <= MAX_PINS; i++) { pca9685Board.setSwitchRange(i, 1200, 1800); } } void loop() { delay(1000); int pinNo = random(0, MAX_PINS); Serial.print("MAX PIN "); Serial.println(MAX_PINS); Serial.print("PIN NO "); Serial.println(pinNo); pca9685Board.throwSwitch(pinNo); pca9685Board.displayPinState(); delay(1000); pca9685Board.closeSwitch(pinNo); pca9685Board.displayPinState(); delay(1000); }
19.787879
47
0.696784
true
217
f041eae7507abc189822c3683cf23ac61a320551
1,419
ino
Arduino
Prueba_Serial_event/Prueba_serial/Cambio_Automatico.ino
quichy3016/Proyecto_Final_Tunel
6aaf7a7158fe7de3fdab81aa8a6eb72e367593ae
[ "MIT" ]
null
null
null
Prueba_Serial_event/Prueba_serial/Cambio_Automatico.ino
quichy3016/Proyecto_Final_Tunel
6aaf7a7158fe7de3fdab81aa8a6eb72e367593ae
[ "MIT" ]
null
null
null
Prueba_Serial_event/Prueba_serial/Cambio_Automatico.ino
quichy3016/Proyecto_Final_Tunel
6aaf7a7158fe7de3fdab81aa8a6eb72e367593ae
[ "MIT" ]
0
null
null
void cambio_automatico(){ if (cambio1==0){ //Control=1; if (entrada[3]==0){ entrada[3] = 1; //Encendido = 1; //Habilito Ai1 Serial.println("Habilito Ai1");} if ((millis()-tiempoautomatico)>=5000){ if (entrada[0]==0){ entrada[0] = 1; Serial.println("Doy Marcha");}} //RUNSTOP = 1; //Doy Marcha if ((millis()-tiempoautomatico)>=10000){ entrada[2]=1; Serial.println("Activo Control"); cambio1 = 1; inc=0; inc1=1;} } else{ if (inc1<=len-1){ if (cambio==1){ Inref1=entrada1[inc]; Serial.println(Inref1); vtiempoant=millis(); cambio=0; } if ((millis()-vtiempoant)>=entrada1[inc1]*1000){ inc = inc+2; inc1 = inc1+2; cambio=1; tiemporetardo=millis(); } }else { if (entrada[0]==1){ entrada[0] = 0; //RUNSTOP = 0; //Apago Motor Serial.println("Apago Motor");} if (entrada[2]==1){ entrada[2]=0; Serial.println("Desactivo Control");} Control=0; if ((millis()-tiemporetardo)>3000){ if (entrada[3]==1){ entrada[3] = 0; //Encendido = 0; //Deshabilito Ai1 Serial.println("Deshabilito Ai1");} terminoautoma=0; cambio1=0; cambio = 0; ControlAutomatico = 0; }} // Serial.print(Inref1);Serial.print(" "); // Serial.print(vtiempoant);Serial.println(" "); } }
20.565217
67
0.533474
true
473
50c0b26543bf7e3b16575e02ed06b70e4cb8798f
1,664
ino
Arduino
wifi.ino
dancol90/ESP-Led-Clock
964125b217b438544fc4f6dcfadd5540305f6131
[ "BSD-3-Clause" ]
null
null
null
wifi.ino
dancol90/ESP-Led-Clock
964125b217b438544fc4f6dcfadd5540305f6131
[ "BSD-3-Clause" ]
null
null
null
wifi.ino
dancol90/ESP-Led-Clock
964125b217b438544fc4f6dcfadd5540305f6131
[ "BSD-3-Clause" ]
0
null
null
/*############################################################################################ ESP-Led-Clock WiFi connected LED clock based on ESP8266 Author: Daniele Colanardi License: BSD, see LICENSE file ############################################################################################*/ bool initWifi() { byte status = 0; char msg[40]; // Don't even try to connect if no config is provided. if (strlen(config.wifi_ssid) != 0) { // Station mode, connect to AP. WiFi.mode(WIFI_STA); WiFi.begin(config.wifi_ssid, config.wifi_key); // Set scroll message strcpy(scroll.text, "CONNECTING"); do { status = WiFi.status(); // Reshow the message if WiFi isn't connected yet. if (!scroll.scrolling) startScroll(); delay(200); } while (status != WL_CONNECTED && status != WL_CONNECT_FAILED); } // At this point the connection can be established or there can be errors if (status == WL_CONNECTED) { // Connected. Get the module's IP address. IPAddress ip = WiFi.localIP(); // Show new message with connection info sprintf(scroll.text, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); startScroll(); // Everything all right, go on. return true; } else { // Error, enter in configuration mode. WiFi.mode(WIFI_AP); WiFi.softAP("ESP-Led-Clock"); // Show new message with connection info strcpy(scroll.text, "CONFIGURATION MODE"); startScroll(); return false; } }
28.20339
94
0.504207
true
351
64f2046e72626dace00317c144059ac35a042dc3
214
ino
Arduino
Basic/1.Demo.ino
hocarm/TIVA-Energia
6fa34ddc908156b14b65b8160401e2d03a239446
[ "MIT" ]
null
null
null
Basic/1.Demo.ino
hocarm/TIVA-Energia
6fa34ddc908156b14b65b8160401e2d03a239446
[ "MIT" ]
null
null
null
Basic/1.Demo.ino
hocarm/TIVA-Energia
6fa34ddc908156b14b65b8160401e2d03a239446
[ "MIT" ]
0
null
null
void setup() { // put your setup code here, to run once: //Day la noi ban dat code cau hinh } void loop() { // put your main code here, to run repeatedly: //Day la noi viet code chuong trinh chinh }
15.285714
48
0.640187
true
62
4bee0e04bec56c84ab19b75f908bf5677c57b8fa
540
ino
Arduino
examples/ledSender/ledSender.ino
Thesoce60/Transmission_library
60fad511e64b75604f553f4572d6689a0d013bdb
[ "Apache-2.0" ]
null
null
null
examples/ledSender/ledSender.ino
Thesoce60/Transmission_library
60fad511e64b75604f553f4572d6689a0d013bdb
[ "Apache-2.0" ]
null
null
null
examples/ledSender/ledSender.ino
Thesoce60/Transmission_library
60fad511e64b75604f553f4572d6689a0d013bdb
[ "Apache-2.0" ]
0
null
null
#include <Transmission.h> Transmission comander = Transmission(); void setup() { Serial.begin(9600); comander.enableLog(true); comander.setStream(&Serial); comander.setTimeout(5000); Result response = comander.sendPinDeclaration(13, OUTPUT); if (response.state == State_TIMEOUT) { while (1);// the receiver haven't awnser the query after the timeout time, Waiting for restart } } void loop() { comander.sendPinState(13, HIGH); delay(500); comander.sendPinState(13, LOW); delay(500); }
24.545455
102
0.677778
true
133
28e8d253c899e2564a24d4503c7964b56fe64871
19,411
ino
Arduino
tasmota/Tasmota-6.7.1/sonoff/xsns_34_hx711.ino
zorcec/SARAH
c7936ce9467fb11594b6ae4a937d6766060bec05
[ "MIT" ]
null
null
null
tasmota/Tasmota-6.7.1/sonoff/xsns_34_hx711.ino
zorcec/SARAH
c7936ce9467fb11594b6ae4a937d6766060bec05
[ "MIT" ]
null
null
null
tasmota/Tasmota-6.7.1/sonoff/xsns_34_hx711.ino
zorcec/SARAH
c7936ce9467fb11594b6ae4a937d6766060bec05
[ "MIT" ]
0
null
null
/* xsns_34_hx711.ino - HX711 load cell support for Sonoff-Tasmota Copyright (C) 2019 Theo Arends 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/>. */ #ifdef USE_HX711 /*********************************************************************************************\ * HX711 - Load cell as used in a scale * * Source: Sparkfun and https://github.com/bogde/HX711 * * To reset the scale: * - Execute command Sensor34 1 * * To calibrate the scale perform the following tasks: * - Set reference weight once using command Sensor34 3 <reference weight in gram> * - Remove any weight from the scale * - Execute command Sensor34 2 and follow messages shown \*********************************************************************************************/ #define XSNS_34 34 #ifndef HX_MAX_WEIGHT #define HX_MAX_WEIGHT 20000 // Default max weight in gram #endif #ifndef HX_REFERENCE #define HX_REFERENCE 250 // Default reference weight for calibration in gram #endif #ifndef HX_SCALE #define HX_SCALE 120 // Default result of measured weight / reference weight when scale is 1 #endif #define HX_TIMEOUT 120 // A reading at default 10Hz (pin RATE to Gnd on HX711) can take up to 100 milliseconds #define HX_SAMPLES 10 // Number of samples for average calculation #define HX_CAL_TIMEOUT 15 // Calibration step window in number of seconds #define HX_GAIN_128 1 // Channel A, gain factor 128 #define HX_GAIN_32 2 // Channel B, gain factor 32 #define HX_GAIN_64 3 // Channel A, gain factor 64 #define D_JSON_WEIGHT_REF "WeightRef" #define D_JSON_WEIGHT_CAL "WeightCal" #define D_JSON_WEIGHT_MAX "WeightMax" #define D_JSON_WEIGHT_ITEM "WeightItem" #define D_JSON_WEIGHT_CHANGE "WeightChange" enum HxCalibrationSteps { HX_CAL_END, HX_CAL_LIMBO, HX_CAL_FINISH, HX_CAL_FAIL, HX_CAL_DONE, HX_CAL_FIRST, HX_CAL_RESET, HX_CAL_START }; const char kHxCalibrationStates[] PROGMEM = D_HX_CAL_FAIL "|" D_HX_CAL_DONE "|" D_HX_CAL_REFERENCE "|" D_HX_CAL_REMOVE; struct HX { long weight = 0; long last_weight = 0; long sum_weight = 0; long offset = 0; long scale = 1; long weight_diff = 0; uint8_t type = 1; uint8_t sample_count = 0; uint8_t calibrate_step = HX_CAL_END; uint8_t calibrate_timer = 0; uint8_t calibrate_msg = 0; uint8_t pin_sck; uint8_t pin_dout; bool tare_flg = false; bool weight_changed = false; } Hx; /*********************************************************************************************/ bool HxIsReady(uint16_t timeout) { // A reading can take up to 100 mS or 600mS after power on uint32_t start = millis(); while ((digitalRead(Hx.pin_dout) == HIGH) && (millis() - start < timeout)) { yield(); } return (digitalRead(Hx.pin_dout) == LOW); } long HxRead() { if (!HxIsReady(HX_TIMEOUT)) { return -1; } uint8_t data[3] = { 0 }; uint8_t filler = 0x00; // pulse the clock pin 24 times to read the data data[2] = shiftIn(Hx.pin_dout, Hx.pin_sck, MSBFIRST); data[1] = shiftIn(Hx.pin_dout, Hx.pin_sck, MSBFIRST); data[0] = shiftIn(Hx.pin_dout, Hx.pin_sck, MSBFIRST); // set the channel and the gain factor for the next reading using the clock pin for (unsigned int i = 0; i < HX_GAIN_128; i++) { digitalWrite(Hx.pin_sck, HIGH); digitalWrite(Hx.pin_sck, LOW); } // Replicate the most significant bit to pad out a 32-bit signed integer if (data[2] & 0x80) { filler = 0xFF; } // Construct a 32-bit signed integer unsigned long value = ( static_cast<unsigned long>(filler) << 24 | static_cast<unsigned long>(data[2]) << 16 | static_cast<unsigned long>(data[1]) << 8 | static_cast<unsigned long>(data[0]) ); return static_cast<long>(value); } /*********************************************************************************************/ void HxResetPart(void) { Hx.tare_flg = true; Hx.sum_weight = 0; Hx.sample_count = 0; Hx.last_weight = 0; } void HxReset(void) { HxResetPart(); Settings.energy_frequency_calibration = 0; } void HxCalibrationStateTextJson(uint8_t msg_id) { char cal_text[30]; Hx.calibrate_msg = msg_id; Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, GetTextIndexed(cal_text, sizeof(cal_text), Hx.calibrate_msg, kHxCalibrationStates)); if (msg_id < 3) { MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR("Sensor34")); } } /*********************************************************************************************\ * Supported commands for Sensor34: * * Sensor34 1 - Reset display to 0 * Sensor34 2 - Start calibration * Sensor34 2 <weight in gram> - Set reference weight and start calibration * Sensor34 3 - Show reference weight in gram * Sensor34 3 <weight in gram> - Set reference weight * Sensor34 4 - Show calibrated scale value * Sensor34 4 <scale value> - Set calibrated scale value * Sensor34 5 - Show max weigth in gram * Sensor34 5 <weight in gram> - Set max weight * Sensor34 6 - Show item weigth in decigram * Sensor34 6 <weight in decigram> - Set item weight * Sensor34 7 - Save current weight to be used as start weight on restart * Sensor34 8 0 - Disable JSON weight change message * Sensor34 8 1 - Enable JSON weight change message \*********************************************************************************************/ bool HxCommand(void) { bool serviced = true; bool show_parms = false; char sub_string[XdrvMailbox.data_len +1]; for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) { if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; } } switch (XdrvMailbox.payload) { case 1: // Reset scale HxReset(); Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, "Reset"); break; case 2: // Calibrate if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); } Hx.scale = 1; HxReset(); Hx.calibrate_step = HX_CAL_START; Hx.calibrate_timer = 1; HxCalibrationStateTextJson(3); break; case 3: // WeightRef to user reference if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); } show_parms = true; break; case 4: // WeightCal to user calculated value if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_calibration = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); Hx.scale = Settings.weight_calibration; } show_parms = true; break; case 5: // WeightMax if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_max = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10) / 1000; } show_parms = true; break; case 6: // WeightItem if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_item = (unsigned long)(CharToFloat(subStr(sub_string, XdrvMailbox.data, ",", 2)) * 10); } show_parms = true; break; case 7: // WeightSave Settings.energy_frequency_calibration = Hx.weight; Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, D_JSON_DONE); break; case 8: // Json on weight change if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.SensorBits1.hx711_json_weight_change = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10) & 1; } show_parms = true; break; default: show_parms = true; } if (show_parms) { char item[33]; dtostrfd((float)Settings.weight_item / 10, 1, item); Response_P(PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\"" D_JSON_WEIGHT_ITEM "\":%s,\"" D_JSON_WEIGHT_CHANGE "\":\"%s\"}}"), Settings.weight_reference, Settings.weight_calibration, Settings.weight_max * 1000, item, GetStateText(Settings.SensorBits1.hx711_json_weight_change)); } return serviced; } /*********************************************************************************************/ long HxWeight() { return (Hx.calibrate_step < HX_CAL_FAIL) ? Hx.weight : 0; } void HxInit(void) { Hx.type = 0; if ((pin[GPIO_HX711_DAT] < 99) && (pin[GPIO_HX711_SCK] < 99)) { Hx.pin_sck = pin[GPIO_HX711_SCK]; Hx.pin_dout = pin[GPIO_HX711_DAT]; pinMode(Hx.pin_sck, OUTPUT); pinMode(Hx.pin_dout, INPUT); digitalWrite(Hx.pin_sck, LOW); if (HxIsReady(8 * HX_TIMEOUT)) { // Can take 600 milliseconds after power on if (!Settings.weight_max) { Settings.weight_max = HX_MAX_WEIGHT / 1000; } if (!Settings.weight_calibration) { Settings.weight_calibration = HX_SCALE; } if (!Settings.weight_reference) { Settings.weight_reference = HX_REFERENCE; } Hx.scale = Settings.weight_calibration; HxRead(); HxResetPart(); Hx.type = 1; } } } void HxEvery100mSecond(void) { Hx.sum_weight += HxRead(); Hx.sample_count++; if (HX_SAMPLES == Hx.sample_count) { long average = Hx.sum_weight / Hx.sample_count; // grams long value = average - Hx.offset; // grams Hx.weight = value / Hx.scale; // grams if (Hx.weight < 0) { if (Settings.energy_frequency_calibration) { long difference = Settings.energy_frequency_calibration + Hx.weight; Hx.last_weight = difference; if (difference < 0) { HxReset(); } // Cancel last weight as there seems to be no more weight on the scale } Hx.weight = 0; } else { Hx.last_weight = Settings.energy_frequency_calibration; } if (Hx.tare_flg) { Hx.tare_flg = false; Hx.offset = average; // grams } if (Hx.calibrate_step) { Hx.calibrate_timer--; if (HX_CAL_START == Hx.calibrate_step) { // Skip reset just initiated Hx.calibrate_step--; Hx.calibrate_timer = HX_CAL_TIMEOUT * (10 / HX_SAMPLES); } else if (HX_CAL_RESET == Hx.calibrate_step) { // Wait for stable reset if (Hx.calibrate_timer) { if (Hx.weight < (long)Settings.weight_reference) { Hx.calibrate_step--; Hx.calibrate_timer = HX_CAL_TIMEOUT * (10 / HX_SAMPLES); HxCalibrationStateTextJson(2); } } else { Hx.calibrate_step = HX_CAL_FAIL; } } else if (HX_CAL_FIRST == Hx.calibrate_step) { // Wait for first reference weight if (Hx.calibrate_timer) { if (Hx.weight > (long)Settings.weight_reference) { Hx.calibrate_step--; } } else { Hx.calibrate_step = HX_CAL_FAIL; } } else if (HX_CAL_DONE == Hx.calibrate_step) { // Second stable reference weight if (Hx.weight > (long)Settings.weight_reference) { Hx.calibrate_step = HX_CAL_FINISH; // Calibration done Settings.weight_calibration = Hx.weight / Settings.weight_reference; Hx.weight = 0; // Reset calibration value HxCalibrationStateTextJson(1); } else { Hx.calibrate_step = HX_CAL_FAIL; } } if (HX_CAL_FAIL == Hx.calibrate_step) { // Calibration failed Hx.calibrate_step--; Hx.tare_flg = true; // Perform a reset using old scale HxCalibrationStateTextJson(0); } if (HX_CAL_FINISH == Hx.calibrate_step) { // Calibration finished Hx.calibrate_step--; Hx.calibrate_timer = 3 * (10 / HX_SAMPLES); Hx.scale = Settings.weight_calibration; } if (!Hx.calibrate_timer) { Hx.calibrate_step = HX_CAL_END; // End of calibration } } else { Hx.weight += Hx.last_weight; // grams if (Settings.SensorBits1.hx711_json_weight_change) { if (abs(Hx.weight - Hx.weight_diff) > 4) { // Use 4 gram threshold to decrease "ghost" weights Hx.weight_diff = Hx.weight; Hx.weight_changed = true; } else if (Hx.weight_changed && (Hx.weight == Hx.weight_diff)) { mqtt_data[0] = '\0'; ResponseAppendTime(); HxShow(true); ResponseJsonEnd(); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); Hx.weight_changed = false; } } } Hx.sum_weight = 0; Hx.sample_count = 0; } } void HxSaveBeforeRestart() { Settings.energy_frequency_calibration = Hx.weight; Hx.sample_count = HX_SAMPLES +1; // Stop updating Hx.weight } #ifdef USE_WEBSERVER const char HTTP_HX711_WEIGHT[] PROGMEM = "{s}HX711 " D_WEIGHT "{m}%s " D_UNIT_KILOGRAM "{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr> const char HTTP_HX711_COUNT[] PROGMEM = "{s}HX711 " D_COUNT "{m}%d{e}"; const char HTTP_HX711_CAL[] PROGMEM = "{s}HX711 %s{m}{e}"; #endif // USE_WEBSERVER void HxShow(bool json) { char scount[30] = { 0 }; uint16_t count = 0; float weight = 0; if (Hx.calibrate_step < HX_CAL_FAIL) { if (Hx.weight && Settings.weight_item) { count = (Hx.weight * 10) / Settings.weight_item; if (count > 1) { snprintf_P(scount, sizeof(scount), PSTR(",\"" D_JSON_COUNT "\":%d"), count); } } weight = (float)Hx.weight / 1000; // kilograms } char weight_chr[33]; dtostrfd(weight, Settings.flag2.weight_resolution, weight_chr); if (json) { ResponseAppend_P(PSTR(",\"HX711\":{\"" D_JSON_WEIGHT "\":%s%s}"), weight_chr, scount); #ifdef USE_WEBSERVER } else { WSContentSend_PD(HTTP_HX711_WEIGHT, weight_chr); if (count > 1) { WSContentSend_PD(HTTP_HX711_COUNT, count); } if (Hx.calibrate_step) { char cal_text[30]; WSContentSend_PD(HTTP_HX711_CAL, GetTextIndexed(cal_text, sizeof(cal_text), Hx.calibrate_msg, kHxCalibrationStates)); } #endif // USE_WEBSERVER } } #ifdef USE_WEBSERVER #ifdef USE_HX711_GUI /*********************************************************************************************\ * Optional GUI \*********************************************************************************************/ #define WEB_HANDLE_HX711 "s34" const char S_CONFIGURE_HX711[] PROGMEM = D_CONFIGURE_HX711; const char HTTP_BTN_MENU_MAIN_HX711[] PROGMEM = "<p><form action='" WEB_HANDLE_HX711 "' method='get'><button name='reset'>" D_RESET_HX711 "</button></form></p>"; const char HTTP_BTN_MENU_HX711[] PROGMEM = "<p><form action='" WEB_HANDLE_HX711 "' method='get'><button>" D_CONFIGURE_HX711 "</button></form></p>"; const char HTTP_FORM_HX711[] PROGMEM = "<fieldset><legend><b>&nbsp;" D_CALIBRATION "&nbsp;</b></legend>" "<form method='post' action='" WEB_HANDLE_HX711 "'>" "<p><b>" D_REFERENCE_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' step='0.001' id='p1' placeholder='0' value='%s'></p>" "<br><button name='calibrate' type='submit'>" D_CALIBRATE "</button>" "</form>" "</fieldset><br><br>" "<fieldset><legend><b>&nbsp;" D_HX711_PARAMETERS "&nbsp;</b></legend>" "<form method='post' action='" WEB_HANDLE_HX711 "'>" "<p><b>" D_ITEM_WEIGHT "</b> (" D_UNIT_KILOGRAM ")<br><input type='number' max='6.5535' step='0.0001' id='p2' placeholder='0.0' value='%s'></p>"; void HandleHxAction(void) { if (!HttpCheckPriviledgedAccess()) { return; } AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_HX711); if (WebServer->hasArg("save")) { HxSaveSettings(); HandleConfiguration(); return; } char stemp1[20]; if (WebServer->hasArg("reset")) { snprintf_P(stemp1, sizeof(stemp1), PSTR("Sensor34 1")); // Reset ExecuteWebCommand(stemp1, SRC_WEBGUI); HandleRoot(); // Return to main screen return; } if (WebServer->hasArg("calibrate")) { WebGetArg("p1", stemp1, sizeof(stemp1)); Settings.weight_reference = (!strlen(stemp1)) ? 0 : (unsigned long)(CharToFloat(stemp1) * 1000); HxLogUpdates(); snprintf_P(stemp1, sizeof(stemp1), PSTR("Sensor34 2")); // Start calibration ExecuteWebCommand(stemp1, SRC_WEBGUI); HandleRoot(); // Return to main screen return; } WSContentStart_P(S_CONFIGURE_HX711); WSContentSendStyle(); dtostrfd((float)Settings.weight_reference / 1000, 3, stemp1); char stemp2[20]; dtostrfd((float)Settings.weight_item / 10000, 4, stemp2); WSContentSend_P(HTTP_FORM_HX711, stemp1, stemp2); WSContentSend_P(HTTP_FORM_END); WSContentSpaceButton(BUTTON_CONFIGURATION); WSContentStop(); } void HxSaveSettings(void) { char tmp[100]; WebGetArg("p2", tmp, sizeof(tmp)); Settings.weight_item = (!strlen(tmp)) ? 0 : (unsigned long)(CharToFloat(tmp) * 10000); HxLogUpdates(); } void HxLogUpdates(void) { char weigth_ref_chr[33]; dtostrfd((float)Settings.weight_reference / 1000, Settings.flag2.weight_resolution, weigth_ref_chr); char weigth_item_chr[33]; dtostrfd((float)Settings.weight_item / 10000, 4, weigth_item_chr); AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_JSON_WEIGHT_REF " %s, " D_JSON_WEIGHT_ITEM " %s"), weigth_ref_chr, weigth_item_chr); } #endif // USE_HX711_GUI #endif // USE_WEBSERVER /*********************************************************************************************\ * Interface \*********************************************************************************************/ bool Xsns34(uint8_t function) { bool result = false; if (Hx.type) { switch (function) { case FUNC_EVERY_100_MSECOND: HxEvery100mSecond(); break; case FUNC_COMMAND_SENSOR: if (XSNS_34 == XdrvMailbox.index) { result = HxCommand(); } break; case FUNC_JSON_APPEND: HxShow(1); break; case FUNC_SAVE_BEFORE_RESTART: HxSaveBeforeRestart(); break; #ifdef USE_WEBSERVER case FUNC_WEB_SENSOR: HxShow(0); break; #ifdef USE_HX711_GUI case FUNC_WEB_ADD_MAIN_BUTTON: WSContentSend_P(HTTP_BTN_MENU_MAIN_HX711); break; case FUNC_WEB_ADD_BUTTON: WSContentSend_P(HTTP_BTN_MENU_HX711); break; case FUNC_WEB_ADD_HANDLER: WebServer->on("/" WEB_HANDLE_HX711, HandleHxAction); break; #endif // USE_HX711_GUI #endif // USE_WEBSERVER case FUNC_INIT: HxInit(); break; } } return result; } #endif // USE_HX711
34.174296
193
0.606306
true
5,211
07b29a72eb115a836ea82bf1d5d137985af511fd
909
ino
Arduino
firmware/legacy_and_tests/temp_and_humidity_test/temp_and_humidity_test.ino
nathanshaw/Parrot
a4f7b2983e5aea961dfab1b8abc6a4e3990cd9fb
[ "MIT" ]
null
null
null
firmware/legacy_and_tests/temp_and_humidity_test/temp_and_humidity_test.ino
nathanshaw/Parrot
a4f7b2983e5aea961dfab1b8abc6a4e3990cd9fb
[ "MIT" ]
null
null
null
firmware/legacy_and_tests/temp_and_humidity_test/temp_and_humidity_test.ino
nathanshaw/Parrot
a4f7b2983e5aea961dfab1b8abc6a4e3990cd9fb
[ "MIT" ]
0
null
null
#include <Wire.h> #include "SHTSensor.h" SHTSensor sht; // To use a specific sensor instead of probing the bus use this command: // SHTSensor sht(SHTSensor::SHT3X); void setup() { // put your setup code here, to run once: Wire.begin(); Serial.begin(57600); delay(5000); // let serial console settle if (sht.init()) { Serial.print("init(): success\n"); } else { Serial.print("init(): failed\n"); } sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM); // only supported by SHT3x } void loop() { // put your main code here, to run repeatedly: if (sht.readSample()) { Serial.print("SHT:\n"); Serial.print(" RH: "); Serial.print(sht.getHumidity(), 2); Serial.print("\n"); Serial.print(" T: "); Serial.print(sht.getTemperature(), 2); Serial.print("\n"); } else { Serial.print("Error in readSample()\n"); } delay(1000); }
21.642857
77
0.610561
true
256
646dc7bacfc436ed93020f246c611e96349c493a
6,268
ino
Arduino
examples/merg_ir_sensor/merg_ir_sensor.ino
amaurial/mergCanBus
e8e0d719e285aa1b2cd0801564385083fa84d1f5
[ "Apache-2.0" ]
5
2018-04-19T09:52:40.000Z
2022-01-21T01:20:32.000Z
examples/merg_ir_sensor/merg_ir_sensor.ino
amaurial/mergCanBus
e8e0d719e285aa1b2cd0801564385083fa84d1f5
[ "Apache-2.0" ]
2
2018-05-21T23:42:35.000Z
2020-08-15T15:12:09.000Z
examples/merg_ir_sensor/merg_ir_sensor.ino
amaurial/mergCanBus
e8e0d719e285aa1b2cd0801564385083fa84d1f5
[ "Apache-2.0" ]
7
2015-10-07T14:31:07.000Z
2020-11-30T19:38:58.000Z
/* This example implements a ir sensor controller to detect block occupancy. It drives 16 ir. Can be more in arduino Mega, but it just an example. The module produces ON/OFF events. The vents can be toogled by the first 2 node variables. 0 means ON when train enters, OFF when trains leaves. 1 means the oposit. Each bit of the 2 bytes are to ser togle or not. Usim FLIM mode teach on/off events. It implements all automatic configuration, including learning events. It does not handle DCC messages, but you can do it on your user function. You can change the ports to fit to your arduino. This node uses 500 bytes of EPROM to store events and the other information. See MemoryManagement.h for memory configuration To clear the memory, press pushbutton1 while reseting the arduino */ #include <Arduino.h> #include <SPI.h> //required by the library #include <TimerOne.h> #include <MergCBUS.h> #include <Message.h> #include <EEPROM.h> //required by the library //Module definitions #define NUMSENSORS 8 #define TLIMIT 500 #define RLIMIT 25 struct SENSOR { int port; int state; unsigned long time; unsigned long resets; }; struct SENSOR sensors[NUMSENSORS]; int sensorport[NUMSENSORS]={A8,A9 ,A10 ,A11, A12 ,A13, A14,A15}; //first 2 are to indicate which servo is on. 2 bytes to indicate to togle. 2 for start and end angle #define VAR_PER_SENSOR 1 //variables per servo. used as reserve. it is mostly used by consumers //CBUS definitions #define GREEN_LED 27 //merg green led port #define YELLOW_LED 26 //merg yellow led port #define PUSH_BUTTON 25 //std merg push button #define PUSH_BUTTON1 28 //debug push button #define NODE_VARS 4 //2 for togle events, 2 for spare #define NODE_EVENTS NUMSENSORS*2 //max number of events in case of teaching short events #define EVENTS_VARS VAR_PER_SENSOR //number of variables per event #define DEVICE_NUMBERS NUMSENSORS //number of device numbers. each servo can be a device //arduino mega has 4K, so it is ok. //create the merg object MergCBUS cbus=MergCBUS(NODE_VARS,NODE_EVENTS,EVENTS_VARS,DEVICE_NUMBERS); //timer function to read the can messages void readCanMessages(){ //read the can message and put then in a circular buffer cbus.cbusRead(); } void setup(){ pinMode(PUSH_BUTTON1,INPUT_PULLUP);//debug push button Serial.begin(115200); //Configuration data for the node cbus.getNodeId()->setNodeName("MODIRSEN",8); //node name cbus.getNodeId()->setModuleId(57); //module number cbus.getNodeId()->setManufacturerId(0xA5); //merg code cbus.getNodeId()->setMinCodeVersion(1); //Version 1 cbus.getNodeId()->setMaxCodeVersion(0); cbus.getNodeId()->setProducerNode(true); cbus.getNodeId()->setConsumerNode(false); cbus.setStdNN(999); //standard node number if (digitalRead(PUSH_BUTTON1)==LOW){ //Serial.println(F("Setup new memory")); cbus.setUpNewMemory(); cbus.setSlimMode(); cbus.saveNodeFlags(); } cbus.setLeds(GREEN_LED,YELLOW_LED);//set the led ports cbus.setPushButton(PUSH_BUTTON);//set the push button ports cbus.setUserHandlerFunction(&myUserFunc);//function that implements the node logic cbus.initCanBus(53,CAN_125KBPS,10,200); //initiate the transport layer. pin=53, rate=125Kbps,10 tries,200 millis between each try //create the servos object setupSensors(); //using timer Timer1.initialize(10000);//microseconds Timer1.attachInterrupt(readCanMessages); //Serial.println(F("Setup finished")); } void loop (){ cbus.run();//do all logic if (cbus.getNodeState()==NORMAL){ checkSensors(); } //debug memory if (digitalRead(PUSH_BUTTON1)==LOW){ cbus.dumpMemory(); } } //user defined function. contains the module logic.called every time run() is called. void myUserFunc(Message *msg,MergCBUS *mcbus){ } void checkSensors(){ int state; int i; unsigned long actime; //int s=7; for (i=0;i<NUMSENSORS;i++){ state=getSensorState(i); //Serial.println(state); actime=millis(); if (state==LOW){ if (sensors[i].state==HIGH){ //if (i==s){ /* Serial.print(F("Sensor ")); Serial.print(i); Serial.println(F(" ON")); */ //} sendMessage(true,i); sensors[i].state=LOW; } sensors[i].state=LOW; sensors[i].time=actime; sensors[i].resets++; } else{ if (actime-sensors[i].time>TLIMIT){ if (sensors[i].resets<RLIMIT){ //give extra time sensors[i].time=actime; } else { if (sensors[i].state==LOW){ // if (i==s){ /* Serial.print(F("Sensor ")); Serial.print(i); Serial.print(F(" OFF time: ")); Serial.print(actime-sensors[i].time); Serial.print(F(" resets:")); Serial.println(sensors[i].resets); */ sendMessage(false,i) ; // } sensors[i].state=HIGH; sensors[i].resets=0; } } } } } } //send the can message void sendMessage(bool state,unsigned int sensor){ unsigned int event; bool onEvent=true; event=sensor; if (togleSensor(sensor)){ onEvent=false; } if (onEvent){ cbus.sendOnEvent(true,event); } else{ cbus.sendOffEvent(true,event); } } //check if we have to togle the event bool togleSensor(int sensor){ byte first,second; bool resp=false; first=cbus.getNodeVar(0); second=cbus.getNodeVar(1); //check if the bit is set if (sensor>0 && sensor<9){ if (bitRead(first,sensor)==1){ resp=true; } } else if (sensor>8 && sensor<17){ if (bitRead(second,sensor)==1){ resp=true; } } return resp; } //configure the sensors void setupSensors(){ int i=0; for (i=0;i<NUMSENSORS;i++) { sensors[i].state=HIGH; sensors[i].port=sensorport[i]; pinMode(sensors[i].port,INPUT); } } //read the sensor state byte getSensorState(int i){ //return digitalRead(sensors[i].port); int j; float ntimes; ntimes=30; for (j=0;j<ntimes;j++){ if (digitalRead(sensors[i].port)==0){ return LOW; } } return HIGH; }
27.017241
132
0.65284
true
1,664
31ef0a0a37a5f13f2df151c8e9a94150b8ea4c2b
2,119
ino
Arduino
magnes_http_sever/magnes_http_sever.ino
MOLOCH-dev/EV_Charger_monetization
f58e789dc71d2c300ba3ab619ff3987562c621e9
[ "MIT" ]
null
null
null
magnes_http_sever/magnes_http_sever.ino
MOLOCH-dev/EV_Charger_monetization
f58e789dc71d2c300ba3ab619ff3987562c621e9
[ "MIT" ]
null
null
null
magnes_http_sever/magnes_http_sever.ino
MOLOCH-dev/EV_Charger_monetization
f58e789dc71d2c300ba3ab619ff3987562c621e9
[ "MIT" ]
0
null
null
#include <WiFi.h> #include <WiFiClient.h> #include <WebServer.h> #include "mainPage.h" const char *ssid = "Magnes"; const char *password = "12345678"; int count = 0; String updated_value = "Your input Watt Hours are "; String charge_text = "\nYour Charge is Rs. "; String back_button = "\nYou may press back now"; int wattHours; int charge_per_unit = 10; WebServer server(80); String wattHours_s; void handleRoot() { String s = MAIN_page; server.send(200, "text/html", s); } void handleForm() { //String s = MAIN_page; //s.replace("@@WATTHOUR@@", required_watt_hour_value); String required_watt_hour_value = server.arg("required_watt_hour_value"); //Obtaining input from form on server wattHours = required_watt_hour_value.toInt(); String charge_value = String(wattHours * charge_per_unit); //s.replace("@@COST@@", charge_value); Serial.printf("\nYour input Watt Hours are : %d",wattHours); //server.sendHeader("Location", "/"); server.send(200, "text/plain", updated_value + required_watt_hour_value + charge_text + charge_value + back_button); //Sending Charge as text to Server //server.send(302,"text/html",s); delay(500); } void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println(); Serial.println("Configuring access point..."); WiFi.softAP(ssid, password); //Configuring esp32 as SoftAP (Hotspot) IPAddress myIP = WiFi.softAPIP(); Serial.println(myIP); //IP address of esp32 AP //Server Setup server.on("/", handleRoot); //handleRoot function will be called on searching http:192.168.4.1/ in the browser server.on("/form", handleForm); //handleForm function will be called on clicking submit on the form //Server begin server.begin(); Serial.printf("Connected devices are : %d",WiFi.softAPgetStationNum()); } void loop() { // put your main code here, to run repeatedly: if (WiFi.softAPgetStationNum()!= 0){ if (count == 0){ Serial.printf("\nConnected devices are : %d",WiFi.softAPgetStationNum()); count++; } } server.handleClient(); }
25.841463
153
0.685229
true
557
c532ad6ed1c69669383f38aa7f8ef2dbe7315554
3,193
ino
Arduino
ESP8266_Parsing_web_services/Weather_liquidCrystal/Weather_liquidCrystal.ino
Rupakpoddar/Parsing-web-services
3f4c72c002a262df5cd526e34ebfd52b2bd44cbf
[ "MIT" ]
null
null
null
ESP8266_Parsing_web_services/Weather_liquidCrystal/Weather_liquidCrystal.ino
Rupakpoddar/Parsing-web-services
3f4c72c002a262df5cd526e34ebfd52b2bd44cbf
[ "MIT" ]
null
null
null
ESP8266_Parsing_web_services/Weather_liquidCrystal/Weather_liquidCrystal.ino
Rupakpoddar/Parsing-web-services
3f4c72c002a262df5cd526e34ebfd52b2bd44cbf
[ "MIT" ]
0
null
null
//Written by Rupak Poddar //www.youtube.com/RupakPoddar #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <ArduinoJson.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,20,4); char ssid[] = "Change_this"; //Your SSID char password[] = "Change_this"; //Your password String web_url = "http://api.openweathermap.org/data/2.5/weather?q=New%20Delhi&appid=12841c714e99680a75ed314f17287745"; //Weather API cURL for New Delhi, India void setup() { lcd.init(); lcd.backlight(); Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(1000); //Connect to WiFi network Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("-"); } Serial.println(""); Serial.println("WiFi connected"); HTTPClient http; http.begin(web_url); int httpCode = http.GET(); if(httpCode > 0) { // file found at server if(httpCode == HTTP_CODE_OK) { String payload = http.getString(); //Serial.println(payload); const size_t capacity = JSON_ARRAY_SIZE(1) + JSON_OBJECT_SIZE(1) + 2*JSON_OBJECT_SIZE(2) + JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + JSON_OBJECT_SIZE(6) + JSON_OBJECT_SIZE(13) + 270; DynamicJsonDocument doc(capacity); deserializeJson(doc, payload); float coord_lon = doc["coord"]["lon"]; float coord_lat = doc["coord"]["lat"]; JsonObject weather_0 = doc["weather"][0]; int weather_0_id = weather_0["id"]; const char* weather_0_main = weather_0["main"]; // "Haze" const char* weather_0_description = weather_0["description"]; const char* weather_0_icon = weather_0["icon"]; const char* base = doc["base"]; JsonObject main = doc["main"]; float main_temp = main["temp"]; // 309.18 float main_feels_like = main["feels_like"]; // 306.09 float main_temp_min = main["temp_min"]; // 308.15 float main_temp_max = main["temp_max"]; // 310.15 int main_pressure = main["pressure"]; int main_humidity = main["humidity"]; int visibility = doc["visibility"]; float wind_speed = doc["wind"]["speed"]; // 1.5 int wind_deg = doc["wind"]["deg"]; int clouds_all = doc["clouds"]["all"]; long dt = doc["dt"]; // 1589814028 JsonObject sys = doc["sys"]; int sys_type = sys["type"]; int sys_id = sys["id"]; const char* sys_country = sys["country"]; // "IN" long sys_sunrise = sys["sunrise"]; long sys_sunset = sys["sunset"]; int timezone = doc["timezone"]; long id = doc["id"]; const char* name = doc["name"]; // "New Delhi" int cod = doc["cod"]; // 200 lcd.clear(); lcd.setCursor(0,0); lcd.print(main_temp-273); lcd.print(" C"); lcd.setCursor(0,1); lcd.print(String(weather_0_main)+" "+String(main_temp_max-273)+"/"+String(main_temp_min-273)+" C"); lcd.setCursor(0,2); lcd.print("Feels like: "); lcd.print(main_feels_like-273); lcd.setCursor(0,3); lcd.print(name); } } else { Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str()); } http.end(); ESP.deepSleep(108e8, WAKE_RF_DEFAULT); //Sleep for 3 hours } void loop() {}
26.831933
186
0.660194
true
929
b4ccb80736afd770b5dc32c3731f2502c98b9741
12,444
ino
Arduino
slave64/slave64.ino
rrweller/ESP8266-LED-Lamp
61a0f1bf98cb248be70032b5881552ff21057c52
[ "MIT" ]
null
null
null
slave64/slave64.ino
rrweller/ESP8266-LED-Lamp
61a0f1bf98cb248be70032b5881552ff21057c52
[ "MIT" ]
null
null
null
slave64/slave64.ino
rrweller/ESP8266-LED-Lamp
61a0f1bf98cb248be70032b5881552ff21057c52
[ "MIT" ]
0
null
null
#define FASTLED_INTERRUPT_RETRY_COUNT 0 #define FASTLED_ALLOW_INTERRUPTS 0 #include <FastLED.h> #include <ESP8266WiFi.h> #include <WiFiUDP.h> #include "reactive_common.h" #define LED_PIN D2 #define NUM_LEDS 64 #define MIC_LOW 6 //#define MIC_HIGH 160 //My phone #define MIC_HIGH 320 //Chromecast #define SAMPLE_SIZE 6 #define LONG_TERM_SAMPLES 250 #define BUFFER_DEVIATION 400 #define BUFFER_SIZE 3 #define LAMP_ID 2 WiFiUDP UDP; const char *ssid = "sound_reactive"; // The SSID (name) of the Wi-Fi network you want to connect to const char *password = "123456789"; // The password of the Wi-Fi network CRGB leds[NUM_LEDS]; struct averageCounter *samples; struct averageCounter *longTermSamples; struct averageCounter* sanityBuffer; float globalHue; float globalBrightness = 255; int hueOffset = 120; float fadeScale = 1.15; float hueIncrement = 0.7; struct led_command { uint8_t opmode; uint32_t data; }; unsigned long lastReceived = 0; unsigned long lastHeartBeatSent; const int heartBeatInterval = 100; bool fade = false; struct led_command cmd; void connectToWifi(); void setup() { globalHue = 0; samples = new averageCounter(SAMPLE_SIZE); longTermSamples = new averageCounter(LONG_TERM_SAMPLES); sanityBuffer = new averageCounter(BUFFER_SIZE); while(sanityBuffer->setSample(250) == true) {} while (longTermSamples->setSample(200) == true) {} FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS); Serial.begin(115200); // Start the Serial communication to send messages to the computer delay(10); Serial.println('\n'); WiFi.begin(ssid, password); // Connect to the network Serial.print("Connecting to "); Serial.print(ssid); Serial.println(" ..."); connectToWifi(); sendHeartBeat(); setAll(0, 0, 0); //reset LEDs to off colorWipe(0, 0, 255, 2); delay(100); setAll(0, 0, 0); UDP.begin(7001); } void sendHeartBeat() { struct heartbeat_message hbm; hbm.client_id = LAMP_ID; hbm.chk = 77777; Serial.println("Sending heartbeat"); IPAddress ip(192,168,4,1); UDP.beginPacket(ip, 7171); int ret = UDP.write((char*)&hbm,sizeof(hbm)); printf("Returned: %d, also sizeof hbm: %d \n", ret, sizeof(hbm)); UDP.endPacket(); lastHeartBeatSent = millis(); } void loop() { if (millis() - lastHeartBeatSent > heartBeatInterval) { sendHeartBeat(); } int packetSize = UDP.parsePacket(); if (packetSize) { UDP.read((char *)&cmd, sizeof(struct led_command)); lastReceived = millis(); } if(millis() - lastReceived >= 5000) { connectToWifi(); } int opMode = cmd.opmode; int analogRaw = cmd.data; switch (opMode) { case 1: fade = false; soundReactive(analogRaw); break; case 2: fade = false; allWhite(); break; case 3: chillFade(); break; case 4: fade = false; CylonBounce(0xff, 0, 0, 4, 4, 100); //color, color, color, eyesize, speeddelay(bigger = slower), returndelay break; case 5: fade = false; TwinkleRandom(10, 200, false); //count, timepassed(speed), onlyonepixel? break; case 6: fade = false; meteorRain(0xff,0xff,0xff,10, 64, true, 30); //color, color, color, meteorsize, taildecay, randomtail?, speeddelay break; case 7: fade = false; Sparkle(random(255), random(255), random(255), 0); //color, color, color, speeddelay break; case 8: fade = false; colorWipe(0x00,0xff,0x00, 50); colorWipe(0x00,0x00,0x00, 50); //color, color, color, speeddelay break; case 9: fade = false; Fire(55,120,15); //cooling(higher = shorter flames, ideal from 20-100), sparking(higher = more active, ideal from 50,200), speeddelay break; } } //------------------------------Wifi Stuff------------------------------ void connectToWifi() { WiFi.mode(WIFI_STA); int i = 0; while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect CylonBounce(0xff, 0, 0, 4, 4, 100); } Serial.println('\n'); Serial.println("Connection established!"); Serial.print("IP address:\t"); Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer lastReceived = millis(); } float fscale(float originalMin, float originalMax, float newBegin, float newEnd, float inputValue, float curve) { float OriginalRange = 0; float NewRange = 0; float zeroRefCurVal = 0; float normalizedCurVal = 0; float rangedValue = 0; boolean invFlag = 0; // condition curve parameter // limit range if (curve > 10) curve = 10; if (curve < -10) curve = -10; curve = (curve * -.1); // - invert and scale - this seems more intuitive - postive numbers give more weight to high end on output curve = pow(10, curve); // convert linear scale into lograthimic exponent for other pow function // Check for out of range inputValues if (inputValue < originalMin) { inputValue = originalMin; } if (inputValue > originalMax) { inputValue = originalMax; } // Zero Refference the values OriginalRange = originalMax - originalMin; if (newEnd > newBegin) { NewRange = newEnd - newBegin; } else { NewRange = newBegin - newEnd; invFlag = 1; } zeroRefCurVal = inputValue - originalMin; normalizedCurVal = zeroRefCurVal / OriginalRange; // normalize to 0 - 1 float // Check for originalMin > originalMax - the math for all other cases i.e. negative numbers seems to work out fine if (originalMin > originalMax) { return 0; } if (invFlag == 0) { rangedValue = (pow(normalizedCurVal, curve) * NewRange) + newBegin; } else // invert the ranges { rangedValue = newBegin - (pow(normalizedCurVal, curve) * NewRange); } return rangedValue; } //------------------------------Default Functions------------------------------ void allWhite() { for (int i = 0; i < NUM_LEDS; i++) { leds[i] = CRGB(255, 255, 235); } delay(5); FastLED.show(); } void chillFade() { static int fadeVal = 0; static int counter = 0; static int from[3] = {0, 234, 255}; static int to[3] = {255, 0, 214}; static int i, j; static double dsteps = 500.0; static double s1, s2, s3, tmp1, tmp2, tmp3; static bool reverse = false; if (fade == false) { for (int i = 0; i < NUM_LEDS; i++) { leds[i] = CRGB(from[0], from[1], from[2]); } s1 = double((to[0] - from[0])) / dsteps; s2 = double((to[1] - from[1])) / dsteps; s3 = double((to[2] - from[2])) / dsteps; tmp1 = from[0], tmp2 = from[1], tmp3 = from[2]; fade = true; } if (!reverse) { tmp1 += s1; tmp2 += s2; tmp3 += s3; } else { tmp1 -= s1; tmp2 -= s2; tmp3 -= s3; } for (j = 0; j < NUM_LEDS; j++) leds[j] = CRGB((int)round(tmp1), (int)round(tmp2), (int)round(tmp3)); FastLED.show(); delay(5); counter++; if (counter == (int)dsteps) { reverse = !reverse; tmp1 = to[0], tmp2 = to[1], tmp3 = to[2]; counter = 0; } } void soundReactive(int analogRaw) { int sanityValue = sanityBuffer->computeAverage(); if (!(abs(analogRaw - sanityValue) > BUFFER_DEVIATION)) { sanityBuffer->setSample(analogRaw); } analogRaw = fscale(MIC_LOW, MIC_HIGH, MIC_LOW, MIC_HIGH, analogRaw, 0.4); if (samples->setSample(analogRaw)) return; uint16_t longTermAverage = longTermSamples->computeAverage(); uint16_t useVal = samples->computeAverage(); longTermSamples->setSample(useVal); int diff = (useVal - longTermAverage); if (diff > 5) { if (globalHue < 235) { globalHue += hueIncrement; } } else if (diff < -5) { if (globalHue > 2) { globalHue -= hueIncrement; } } int curshow = fscale(MIC_LOW, MIC_HIGH, 0.0, (float)NUM_LEDS, (float)useVal, 0); //int curshow = map(useVal, MIC_LOW, MIC_HIGH, 0, NUM_LEDS) for (int i = 0; i < NUM_LEDS; i++) { if (i < curshow) { leds[i] = CHSV(globalHue + hueOffset + (i * 2), 255, 255); } else { leds[i] = CRGB(leds[i].r / fadeScale, leds[i].g / fadeScale, leds[i].b / fadeScale); } } delay(5); FastLED.show(); } //------------------------------Custom Functions------------------------------ void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) { setAll(0,0,0); for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) { // fade brightness all LEDs one step for(int j=0; j<NUM_LEDS; j++) { if( (!meteorRandomDecay) || (random(10)>5) ) { fadeToBlack(j, meteorTrailDecay ); } } // draw meteor for(int j = 0; j < meteorSize; j++) { if( ( i-j <NUM_LEDS) && (i-j>=0) ) { setPixels(i-j, red, green, blue); } } FastLED.show(); delay(SpeedDelay); } } void CylonBounce(byte red, byte green, byte blue, int EyeSize, int SpeedDelay, int ReturnDelay){ for(int i = 0; i < NUM_LEDS-EyeSize-2; i++) { setAll(0,0,0); setPixels(i, red/10, green/10, blue/10); for(int j = 1; j <= EyeSize; j++) { setPixels(i+j, red, green, blue); } setPixels(i+EyeSize+1, red/10, green/10, blue/10); FastLED.show(); delay(SpeedDelay); } delay(ReturnDelay); for(int i = NUM_LEDS-EyeSize-2; i > 0; i--) { setAll(0,0,0); setPixels(i, red/10, green/10, blue/10); for(int j = 1; j <= EyeSize; j++) { setPixels(i+j, red, green, blue); } setPixels(i+EyeSize+1, red/10, green/10, blue/10); FastLED.show(); delay(SpeedDelay); } delay(ReturnDelay); } void TwinkleRandom(int Count, int SpeedDelay, boolean OnlyOne) { for (int i=0; i<Count; i++) { setPixels(random(NUM_LEDS),random(0,255),random(0,255),random(0,255)); FastLED.show(); delay(SpeedDelay); if(OnlyOne) { setAll(0,0,0); } } delay(SpeedDelay); } void Sparkle(byte red, byte green, byte blue, int SpeedDelay) { setAll(0,0,0); int Pixel = random(NUM_LEDS); setPixels(Pixel,red,green,blue); FastLED.show(); delay(SpeedDelay); setPixels(Pixel,0,0,0); } void colorWipe(byte red, byte green, byte blue, int SpeedDelay) { setAll(0,0,0); for(uint16_t i=0; i<NUM_LEDS; i++) { setPixels(i, red, green, blue); FastLED.show(); delay(SpeedDelay); } } void Fire(int Cooling, int Sparking, int SpeedDelay) { static byte heat[NUM_LEDS]; int cooldown; setAll(0,0,0); // Step 1. Cool down every cell a little for( int i = 0; i < NUM_LEDS; i++) { cooldown = random(0, ((Cooling * 10) / NUM_LEDS) + 2); if(cooldown>heat[i]) { heat[i]=0; } else { heat[i]=heat[i]-cooldown; } } // Step 2. Heat from each cell drifts 'up' and diffuses a little for( int k= NUM_LEDS - 1; k >= 2; k--) { heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2]) / 3; } // Step 3. Randomly ignite new 'sparks' near the bottom if( random(255) < Sparking ) { int y = random(7); heat[y] = heat[y] + random(160,255); //heat[y] = random(160,255); } // Step 4. Convert heat to LED colors for( int j = 0; j < NUM_LEDS; j++) { setPixelHeatColor(j, heat[j] ); } FastLED.show(); delay(SpeedDelay); } void setPixelHeatColor (int Pixel, byte temperature) { setAll(0,0,0); // Scale 'heat' down from 0-255 to 0-191 byte t192 = round((temperature/255.0)*191); // calculate ramp up from byte heatramp = t192 & 0x3F; // 0..63 heatramp <<= 2; // scale up to 0..252 // figure out which third of the spectrum we're in: if( t192 > 0x80) { // hottest setPixels(Pixel, 255, 255, heatramp); } else if( t192 > 0x40 ) { // middle setPixels(Pixel, 255, heatramp, 0); } else { // coolest setPixels(Pixel, heatramp, 0, 0); } } //------------------------------Dependency Functions------------------------------ void fadeToBlack(int ledNo, byte fadeValue) { leds[ledNo].fadeToBlackBy( fadeValue ); } void setPixels(int Pixel, byte red, byte green, byte blue) { leds[Pixel].r = red; leds[Pixel].g = green; leds[Pixel].b = blue; } void setAll(byte red, byte green, byte blue) { for(int i = 0; i < NUM_LEDS; i++ ) { setPixels(i, red, green, blue); } FastLED.show(); }
23.748092
135
0.600289
true
3,925
22dad26ff91def9add6d97cd8ffc1ec6cd298796
1,979
ino
Arduino
capacitive_sensor.ino
BareConductive/simple_cap_sensor
dc0e304a4300a6f520d6f205e054513b26682218
[ "MIT" ]
null
null
null
capacitive_sensor.ino
BareConductive/simple_cap_sensor
dc0e304a4300a6f520d6f205e054513b26682218
[ "MIT" ]
null
null
null
capacitive_sensor.ino
BareConductive/simple_cap_sensor
dc0e304a4300a6f520d6f205e054513b26682218
[ "MIT" ]
0
null
null
/******************************************************************************* Bare Conductive Capacitive Proximity Sensor ------------------------------------------- For Arduino boards. Use a large resistor, about 1M between pin 2 and 4 and connect pin 2 to a sensor, for example Electric Paint. Based on code by Paul Badger. Bare Conductive code written by Pascal Loose This work is licensed under a MIT license https://opensource.org/licenses/MIT Copyright (c) 2020, Bare Conductive Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *******************************************************************************/ // capacitive sensing includes #include <CapacitiveSensor.h> // capacitive sensing constant CapacitiveSensor sensor = CapacitiveSensor(4,2); // 1M resistor between pins 4 & 2, pin 2 is sensor pin void setup() { Serial.begin(115200); } void loop() { long measurement = sensor.capacitiveSensor(30); Serial.println(measurement); delay(10); }
37.339623
104
0.69429
true
395
2d072b14ca7d7c2c473418f5a7b81c8287d9c95c
3,228
ino
Arduino
libraries/AESLib/examples/base64_iv/base64_iv.ino
bnossn/ESP32Lora
e6b87f15fab5bf27ddfcda62c55ac4fb42e9dd3e
[ "MIT" ]
1
2019-05-20T10:23:00.000Z
2019-05-20T10:23:00.000Z
libraries/AESLib/examples/base64_iv/base64_iv.ino
bnossn/ESP32Lora
e6b87f15fab5bf27ddfcda62c55ac4fb42e9dd3e
[ "MIT" ]
null
null
null
libraries/AESLib/examples/base64_iv/base64_iv.ino
bnossn/ESP32Lora
e6b87f15fab5bf27ddfcda62c55ac4fb42e9dd3e
[ "MIT" ]
0
null
null
/* Example taking test values from node.js server as input as well... */ #include "AESLib.h" AESLib aesLib; String plaintext = "12345678;"; int loopcount = 0; char cleartext[256]; char ciphertext[512]; // AES Encryption Key byte aes_key[] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }; // General initialization vector (you must use your own IV's in production for full security!!!) byte aes_iv[N_BLOCK] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Sample strings as generated by node.js server String server_b64iv = "AAAAAAAAAAAAAAAAAAAAAAAA=="; // same as aes_iv but in Base-64 form as received from server String server_b64msg = "ei6NxsBeWk7hj41eia3S0LdkAlm2qxpRbmcsrd23TTc="; // same as aes_iv but in Base-64 form as received from server // Generate IV (once) void aes_init() { // workaround for incorrect B64 functionality on first run... encrypt("HELLO WORLD!", aes_iv); print_key_iv(); // reset aes_iv to server-based value int ivLen = base64_decode((char*)server_b64iv.c_str(), (char *)aes_iv, server_b64iv.length()); Serial.print("Decoded IV bytes: "); Serial.println(ivLen); print_key_iv(); } String encrypt(char * msg, byte iv[]) { int msgLen = strlen(msg); char encrypted[2 * msgLen]; aesLib.encrypt64(msg, encrypted, aes_key, iv); return String(encrypted); } String decrypt(char * msg, byte iv[]) { unsigned long ms = micros(); int msgLen = strlen(msg); char decrypted[msgLen]; // half may be enough aesLib.decrypt64(msg, decrypted, aes_key, iv); return String(decrypted); } void print_key_iv() { int i; /* Serial.println("AES Key: "); for (i = 0; i < sizeof(aes_key); i++) { Serial.print(aes_key[i], DEC); if ((i + 1) < sizeof(aes_key)) { Serial.print(","); } } Serial.println(""); */ Serial.println("AES IV: "); for (i = 0; i < sizeof(aes_iv); i++) { Serial.print(aes_iv[i], DEC); if ((i + 1) < sizeof(aes_iv)) { Serial.print(","); } } Serial.println(""); } void setup() { Serial.begin(115200); aes_init(); print_key_iv(); byte enc_iv[N_BLOCK] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // iv_block gets written to, provide own fresh copy... // first decrypt after init should use aes_iv as given by server to test bare string first String decrypted = decrypt((char*)server_b64msg.c_str(), enc_iv); // aes_iv fails here, incorrectly decoded... Serial.print("Server Cleartext: "); Serial.println(decrypted); print_key_iv(); } void loop() { loopcount++; sprintf(cleartext, "START; %i \n", loopcount); print_key_iv(); // Encrypt byte enc_iv[N_BLOCK] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // iv_block gets written to, provide own fresh copy... String encrypted = encrypt(cleartext, enc_iv); sprintf(ciphertext, "%s", encrypted.c_str()); Serial.print("Ciphertext: "); Serial.println(encrypted); // Decrypt byte dec_iv[N_BLOCK] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // iv_block gets written to, provide own fresh copy... String decrypted = decrypt(ciphertext, dec_iv); Serial.print("Cleartext: "); Serial.println(decrypted); delay(500); }
27.589744
133
0.649009
true
1,071
f7bbd97bce0505f79e3bfcfc9665c6cd933787d6
10,225
ino
Arduino
chronograph.ino
AkioFujimoto/chronographSD
25136738d2f46da1fe02dd1245433a84f1336661
[ "MIT" ]
null
null
null
chronograph.ino
AkioFujimoto/chronographSD
25136738d2f46da1fe02dd1245433a84f1336661
[ "MIT" ]
null
null
null
chronograph.ino
AkioFujimoto/chronographSD
25136738d2f46da1fe02dd1245433a84f1336661
[ "MIT" ]
0
null
null
/* Chronograph with SD recording. Time Keeper v2.3 based on SD Example. by 2014- Akio Fujimoto. I appriciate to Arduino team, and its library! The circuit: * SD card attached to SPI bus as follows: CM Pin role Pin No. ++ CS 8 ++ MOSI 11 ++ MISO 12 ++ SCLK 13 ++ Hardware Reserved 10 /*Don't touch it!!*/ ++ LCD_RS 2 ++ LCD_RW GND ++ LCD_Enable 3 ++ DataBit4..7 4..7 // Use the LCD module as "4-bit mode", for saving GPIO pins. ++ SW_record_time 9 !+ SW_stop_timekeep 0 / UART RX ++ SW_start A0 ++ SW_pause A1 ++ SW_reset_time A2 C stands for a connect. M stands for a Modified. just like a emacs view., as below. CM Pin role Pin No. // Warning! can't use Serial functions due to pin0 using as switch... */ #define hardwareSS 10 // don't touch it! #define CS 8 // you can change this except 10. #include <SD.h> #include <KanaLiquidCrystal.h> #include <LiquidCrystal.h> #include <EEPROM.h> #include <avr/io.h> #include <avr/interrupt.h> File myFile; const int sw = 9; const int sw_owari = 0; const int sw_start = 14; // A0 const int sw_pause = 15; // A1 const int sw_reset = 16; // A2 const int timeDelta = 3; // 3/100 second resolution. const int dTime = 999; int state = 0; int oldState = 0; int state2 = 0; int oldState2 = 0; int val = 0; int oldVal; int hour = 0; int minute = 0; int second = 0; int sSec = 0; int curTime = 0; int processTime = 0; char hPad = ' '; char mPad = ' '; char sPad = ' '; int iter = 0; // variable for iteration. int time = 100; // key scan iterations. Entire loop must be 1 second. //int dms = 268; // delay in usec. used in keyscan iteration. //int dms = 259; // okureteru // revised algorhythm. "(big wait)delay -> (bit wait)delayMicroseconds" int dms = 787; // inc. to slow. dec. to fast. //int dms = 793 // accurate in loop range is between 7-8ms. int dTime2 = 17; int eeAddress = 0; int eeValue = dms; KanaLiquidCrystal lcd(2, 3, 4, 5, 6, 7); byte gaiji_pause[8] ={ B11011, B11011, B11011, B11011, B11011, B11011, B11011, }; byte gaiji_start[8] = { B11000, B11100, B11110, B11111, B11110, B11100, B11000, B00000, }; byte gaiji_sd[8] = { B11100, B10010, B10001, B10001, B10001, B11111, B00000, B00000, }; // 4bitMode (rs, rw, d4, d5, d6, d7) void setup() { delay(1000); lcd.createChar(0, gaiji_pause); lcd.createChar(1, gaiji_start); lcd.createChar(2, gaiji_sd); lcd.begin(16,2); lcd.kanaOn(); dms = eeRead(eeAddress); // lcd.noBlink(); pinMode(sw, INPUT_PULLUP); // time record sw. pinMode(sw_owari, INPUT_PULLUP); // time record stop sw. pinMode(sw_start, INPUT_PULLUP); // chrono start sw. pinMode(sw_pause, INPUT_PULLUP); // chrono pause sw. pinMode(sw_reset, INPUT_PULLUP); // chrono reset sw. // Open serial communications and wait for port to open: Serial.begin(9600); /* while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } */ Serial.println(dms); Serial.print("Initializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boards, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(hardwareSS, OUTPUT); if (!SD.begin(CS)) { Serial.println("initialization failed!"); return; } Serial.println("initialization done."); // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. myFile = SD.open("test.txt", FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.print("Writing to test.txt..."); if(digitalRead(sw) == LOW){ myFile.println(time); } myFile.println("testing 1, 2, 3."); // close the file: Serial.println("done."); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } // re-open the file for reading: myFile = SD.open("test.txt", FILE_WRITE); if (myFile) { Serial.println("test.txt:"); // read from the file until there's nothing else in it: while (myFile.available()) { Serial.write(myFile.read()); } // close the file: // myFile.close(); lcd.clear(); lcd.print(F("スタート ボタンヲ オスト")); lcd.setCursor(0,1); lcd.print(F("ケイソク ヲ カイシ シマス")); lcd.setCursor(15,0); lcd.kanaOff(); lcd.write(byte(2)); lcd.kanaOn(); Serial.println("waiting for trigger."); //sw_start while(1){ if(digitalRead(sw_start) == LOW) break; } lcd.clear(); lcd.setCursor(14,0); lcd.write(byte(1)); // (gaiji_start); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } myFile = SD.open("test.txt", FILE_WRITE); while (myFile.available()) { myFile.read(); } } void loop(){ // nothing happens after setup delay(dTime2); delayMicroseconds(dms); __asm__("nop"); curTime = 0; curTime = millis(); sSec += timeDelta; //if(time % 3600 > 0){ // hour++; //}else if(time%60 > 0){ // minute++; // if(minute>=60){minute=0;time++;} //} //if(minute>=60){hour++;} if(minute>=60){ minute=0; hour++; } if(second>=60){ second = 0; minute++; } if(sSec>=100){ sSec=0; second++; } /* if(hour/10 == 0){ hPad = ' '; } else{ hPad = ' '; } if(minute/10 == 0){ mPad = ' '; } else{ mPad = ' '; } if(second/10 == 0){ sPad = ' '; } else{ sPad = ' '; } */ // sw_pause, and adjust time. state = digitalRead(sw_pause); if(state == LOW && oldState == HIGH){ Serial.println("Paused!"); lcd.setCursor(14,0); lcd.write(byte(0)); // (gaiji_pause); delay(10); myFile.println(F("PAUSED AT")); myFile.println(hour); myFile.println(minute); myFile.println(second); myFile.println(sSec); myFile.println(); while(1){ lcd.kanaOff(); lcd.setCursor(14,0); lcd.write(byte(0)); delay(100); lcd.kanaOn(); if(digitalRead(sw_pause)==LOW) { eeWrite(eeAddress, eeValue); Serial.print("EEPROM "); Serial.print(eeAddress); Serial.print(", "); Serial.println(eeValue); break; } timeAdjust(); } lcd.clear(); } // sw_reset state2 = digitalRead(sw_reset); if(state2 == LOW && oldState2 == HIGH){ Serial.println("reset!"); lcd.home(); lcd.print(F(" ")); lcd.setCursor(0,1); lcd.print(F(" ")); hour = 0; minute = 0; second = 0; sSec = 0; lcd.home(); } // sw (record time.) if(digitalRead(sw) == LOW){ // negative logic. Serial.println("button"); lcd.setCursor(15,0); lcd.write(0xFF); delay(10); myFile.println(hour); myFile.println(minute); myFile.println(second); myFile.println(sSec); myFile.println(); lcd.setCursor(15,0); lcd.print(" "); // myFile.close(); } if(digitalRead(sw_owari) == LOW){ // negative logic. Serial.println("End of File."); lcd.setCursor(15,0); lcd.write(0xFF); delay(10); myFile.println(hour); myFile.println(minute); myFile.println(second); myFile.println(sSec); myFile.println("EOF"); lcd.setCursor(15,0); lcd.print(" "); closeFile(); lcd.clear(); while(1){ lcd.print("End of file."); lcd.setCursor(0,1); lcd.print("Remove SD Card..."); } } // Serial.println(millis()-curTime); /* Serial.print("Time :"); Serial.print(hour); Serial.print(":"); Serial.print(mPad); Serial.print(minute); Serial.print("."); Serial.print(sPad); Serial.print(second); Serial.print(sPad); Serial.print(sSec); Serial.println(); */ lcd.setCursor(0,0); // lcd.clear(); // lcd.print("Delay :"); // lcd.setCursor(0,1); // lcd.print("Time :"); lcd.setCursor(0,1); lcd.print(hour); if(second%2 == 0){ // even second. lcd.print(" "); } else{ // odd second. lcd.print(":"); } lcd.print(mPad); lcd.print(minute); lcd.print("."); lcd.print(sPad); lcd.print(second); lcd.print("' "); lcd.print(sSec); lcd.print(" "); lcd.setCursor(7,0); processTime = millis() - curTime; lcd.print(processTime); lcd.print("ms "); while(iter<time){ keycheck(); iter++; } iter=0; oldVal = val; oldState = state; oldState2 = state2; } void closeFile(){ myFile.close(); } /* char removePad(char s){ s.erase(); return s; } */ void keycheck(){ if(digitalRead(sw) == LOW){ // negative logic. Serial.println("button"); lcd.setCursor(15,0); lcd.write(0xFF); delay(10); myFile.println(hour); myFile.println(minute); myFile.println(second); myFile.println(sSec); myFile.println(); lcd.setCursor(15,0); lcd.print(" "); // myFile.close(); } if(digitalRead(sw_owari) == LOW){ // negative logic. Serial.println("End of File."); lcd.setCursor(15,0); lcd.write(0xFF); delay(10); myFile.println(hour); myFile.println(minute); myFile.println(second); myFile.println(sSec); myFile.println("EOF"); lcd.setCursor(15,0); lcd.print(" "); closeFile(); lcd.clear(); while(1){ lcd.print("End of file."); lcd.setCursor(0,1); lcd.print("Remove SD Card..."); } } } void timeAdjust(){ //in pause menu. if(digitalRead(sw_start)==LOW){ dms--; } else if(digitalRead(sw_reset)==LOW){ dms++; } if(dms<=0) dms = 0; lcd.setCursor(10,0); lcd.write(0x7E); // -> lcd.print(dms); eeValue = dms; // lcd.write(0xE4); // micro lcd.print(F("mS")); } void eeWrite(int x, int y){ EEPROM.write(x, y/256); // times 256 counts. EEPROM.write(x+1, y%256); // times <=255 counts. } int eeRead(int x){ volatile int value = EEPROM.read(x)*256 + EEPROM.read(x+1); return value; }
20.867347
88
0.580342
true
3,108
e90927e09d1e2e980b0b344d73b2d1d5a81aab4d
564
ino
Arduino
TINKERCAD/TINKERCAD.ino
oscarcasagrande/estudoarduino
9611bacf9ab7176070092be4eb578eb3a3ebaf34
[ "Apache-2.0" ]
null
null
null
TINKERCAD/TINKERCAD.ino
oscarcasagrande/estudoarduino
9611bacf9ab7176070092be4eb578eb3a3ebaf34
[ "Apache-2.0" ]
null
null
null
TINKERCAD/TINKERCAD.ino
oscarcasagrande/estudoarduino
9611bacf9ab7176070092be4eb578eb3a3ebaf34
[ "Apache-2.0" ]
0
null
null
int ldr = A0;//Atribui A0 a variável ldr int valorldr = 0;//Declara a variável valorldr como inteiro void setup() { pinMode(ldr, INPUT);//Define ldr (pino analógico A0) como saída Serial.begin(9600);//Inicialização da comunicação serial, com taxa de transferência em bits por segundo de 9600 } void loop() { valorldr=analogRead(ldr);//Lê o valor do sensor ldr e armazena na variável valorldr Serial.print("Valor lido pelo LDR = ");//Imprime na serial a mensagem Valor lido pelo LDR Serial.println(valorldr);//Imprime na serial os dados de valorldr }
35.25
113
0.742908
true
176
5f0539690f2dbd3d94e3511fbb0d0d2976b24d62
1,042
ino
Arduino
tests/sd/sd.ino
oscarpimentel/snow-weather-station-project
43dbf00ec938684df968bf4d191a7b7af74603d7
[ "MIT" ]
null
null
null
tests/sd/sd.ino
oscarpimentel/snow-weather-station-project
43dbf00ec938684df968bf4d191a7b7af74603d7
[ "MIT" ]
null
null
null
tests/sd/sd.ino
oscarpimentel/snow-weather-station-project
43dbf00ec938684df968bf4d191a7b7af74603d7
[ "MIT" ]
0
null
null
#include <SPI.h> #include <SD.h> File myFile; #define BAUD_RATE 500000 #define SD_PIN 10 // 10 53 void setup() { // Open serial communications and wait for port to open: Serial.begin(BAUD_RATE); while (!Serial) { Serial.print("Initializing SD card..."); // wait for serial port to connect. Needed for native USB port only } while(!SD.begin(SD_PIN)) { Serial.println("initialization sd!"); } Serial.println("initialization done."); // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. myFile = SD.open("test.txt", FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.print("Writing to test.txt..."); myFile.println("This is a test file :)"); myFile.println("testing 1, 2, 3."); for (int i = 0; i < 20; i++) { myFile.println(i); } // close the file: myFile.close(); Serial.println("done."); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } } void loop() { // nothing happens after setup }
25.414634
109
0.680422
true
274
fee32146cd76f797f070d877faec24f25302a93a
29,643
ino
Arduino
e-paper-weather/e-paper-weather.ino/e-paper-weather.ino.ino
martinberlin/esp
0e69060bb3a0b6f7c2a6e0abb91e282e63e8cb9d
[ "MIT" ]
1
2018-10-11T14:41:19.000Z
2018-10-11T14:41:19.000Z
e-paper-weather/e-paper-weather.ino/e-paper-weather.ino.ino
martinberlin/esp
0e69060bb3a0b6f7c2a6e0abb91e282e63e8cb9d
[ "MIT" ]
null
null
null
e-paper-weather/e-paper-weather.ino/e-paper-weather.ino.ino
martinberlin/esp
0e69060bb3a0b6f7c2a6e0abb91e282e63e8cb9d
[ "MIT" ]
0
null
null
/*######################## Weather Display ############################# * Receives and displays the weather forecast from the Weather Underground and then displays using a * JSON decoder wx data to display on a web page using a webserver. * Weather data received via WiFi connection to Weather Underground Servers and using their 'Forecast' API and data * is decoded using Copyright Benoit Blanchon's (c) 2014-2017 excellent JSON library. * This source code is protected under the terms of the MIT License and is copyright (c) 2017 by David Bird and permission is hereby granted, free of charge, to * any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, but not to sub-license and/or * to sell copies of the Software or to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * See more at http://dsbird.org.uk */ #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> #include <ESP8266WebServer.h> #include <ArduinoJson.h> // https://github.com/bblanchon/ArduinoJson #include <WiFiClient.h> #include "time.h" #include <SPI.h> #include <GxEPD.h> //#include <GxGDEW027C44/GxGDEW027C44.cpp> #include <GxGDEW027W3/GxGDEW027W3.cpp> #include <Fonts/FreeSans9pt7b.h> #include <GxIO/GxIO_SPI/GxIO_SPI.cpp> #include <GxIO/GxIO.cpp> #include <pgmspace.h> const char* ssid = "JAZZTEL_0D36"; const char* password = "quiero mucho al leon"; //const char* password = "8zDXHWtWFSdb3ZgX3FM9"; // Lloret const char* domainName= "carlos"; // mDNS: carlos.local // TCP server at port 80 will respond to HTTP requests //WiFiServer server(80); ESP8266WebServer server(80); String City = "Arenys%20de%20Mar"; String Country = "Spain"; // Your country ES=Spain use %20 for spaces (should be urlencoded) boolean skipLoadingScreen = true; // Skips loading screen and makes it faster //################# LIBRARIES ########################## String version = "1.1"; // Version of this program //################ VARIABLES ########################### // pins_arduino.h, e.g. WEMOS D1 Mini //static const uint8_t SS = D8; //static const uint8_t MOSI = D7; //static const uint8_t MISO = ; //static const uint8_t SCK = D5; // GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1); GxIO_Class io(SPI, D8, D3, D4); // GxGDEP015OC1(GxIO& io, uint8_t rst = D4, uint8_t busy = D2); GxEPD_Class display(io, D4, D6); //------ NETWORK VARIABLES--------- // Use your own API key by signing up for a free developer account at http://www.wunderground.com/weather/api/ String API_key = "ecfde31ed95eb892"; // See: http://www.wunderground.com/weather/api/d/docs (change here with your KEY) String Conditions = "conditions"; // See: http://www.wunderground.com/weather/api/d/docs?d=data/index&MR=1 char wxserver[] = "api.wunderground.com"; // Address for WeatherUnderGround unsigned long lastConnectionTime = 0; // Last time you connected to the server, in milliseconds //unsigned long startMillis = millis(); const unsigned long serverDownTime = millis() + 20*60*1000; // Min / Sec / Millis Delay between updates, in milliseconds, WU allows 500 requests per-day maximum, set to every 10-mins or 144/day String Units = "M"; // M for Metric, X for Mixed and I for Imperial //################ PROGRAM VARIABLES and OBJECTS ################ // Conditions String WDay0, Day0, Icon0, High0, Low0, Conditions0, Pop0, Averagehumidity0, WDay1, Day1, Icon1, High1, Low1, Conditions1, Pop1, Averagehumidity1, WDay2, Day2, Icon2, High2, Low2, Conditions2, Pop2, Averagehumidity2, WDay3, Day3, Icon3, High3, Low3, Conditions3, Pop3, Averagehumidity3; // Astronomy String DphaseofMoon, Sunrise, Sunset, Moonrise, Moonset, Moonlight; String currCondString; // string to hold received API weather data String currentTime; const unsigned char thermo_icon[] = { // 64x24 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xf9, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfb, 0xdf, 0xff, 0xff, 0xf3, 0xff, 0xdf, 0xff, 0xfb, 0x5f, 0xff, 0xff, 0xe9, 0xff, 0x0f, 0xff, 0xfb, 0x5f, 0xfc, 0x7f, 0xed, 0xbf, 0x0f, 0xff, 0xfa, 0x5e, 0x18, 0x3f, 0xed, 0x7e, 0x07, 0xff, 0xfb, 0x5e, 0xd9, 0x9f, 0xed, 0x7e, 0x07, 0xff, 0xfb, 0x5e, 0xd3, 0xdf, 0xe3, 0x7c, 0x03, 0xff, 0xfa, 0x5e, 0x13, 0xff, 0xf2, 0xfc, 0x03, 0xdf, 0xfb, 0x5f, 0xf7, 0xff, 0xfe, 0xfc, 0x13, 0xdf, 0xfb, 0x5f, 0xf7, 0xff, 0xfd, 0x9c, 0x07, 0xdf, 0xfa, 0x5f, 0xf7, 0xff, 0xfd, 0x4e, 0x07, 0x8f, 0xfb, 0x5f, 0xf3, 0xdf, 0xfb, 0x6f, 0x0f, 0x8f, 0xfb, 0x5f, 0xf1, 0x9f, 0xfb, 0x6f, 0xff, 0x07, 0xfa, 0x5f, 0xf8, 0x3f, 0xfb, 0x6f, 0xff, 0x07, 0xfa, 0x1f, 0xfc, 0x7f, 0xf7, 0x1f, 0xff, 0x03, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0x9f, 0xfe, 0x03, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x03, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x13, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f }; const unsigned char probrain_icon[] = { // 32x24 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xc7, 0xe0, 0x7f, 0xff, 0xdf, 0xf8, 0x3f, 0xff, 0x1f, 0xff, 0x9f, 0xfc, 0x3f, 0xff, 0xcf, 0xe0, 0x7f, 0xdf, 0xc7, 0xc0, 0xff, 0x9f, 0xc3, 0x9f, 0xff, 0x1f, 0xf9, 0x3f, 0xff, 0x1f, 0xfc, 0x3f, 0xfe, 0x1f, 0xfc, 0x3f, 0xfb, 0x1f, 0xfc, 0x9f, 0xf3, 0x3b, 0xf9, 0xc0, 0x63, 0xf3, 0x03, 0xe0, 0x63, 0xe3, 0x87, 0xff, 0xc3, 0xe3, 0xff, 0xff, 0xe7, 0xc3, 0xff, 0xff, 0xe7, 0xe3, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; WiFiClient client; // wifi client object #include "imglib/gridicons_align_right.h" void setup() { Serial.begin(115200); StartWiFi(ssid,password); currentTime = obtain_time(); display.init(); display.setRotation(3); // Right setup to get KEY1 on top. Funny to comment it and see how it works ;) display.setFont(&FreeSans9pt7b); if (skipLoadingScreen == false) { display.fillScreen(GxEPD_RED); // No need to do this. Init cleans screen display.setTextColor(GxEPD_WHITE); display.setCursor(0, 12); display.println("\n\r FASAREK CORP\n\r"); display.setTextColor(GxEPD_BLACK); display.println("\nReading weather data from:"); display.println(wxserver); display.println("City: "+City+", "+Country); display.setTextColor(GxEPD_WHITE); display.println("Time: "+currentTime); display.update(); } obtain_forecast("forecast"); DisplayForecast(); Serial.print("currentTime = "+currentTime); // Start HTTP server server.onNotFound(handle_http_not_found); server.on("/", handle_http_root); server.on("/lcd-write", handleLcdWrite); delay(4000); server.begin(); // not needed? // Moved to loop() //ESP.deepSleep(0); // ESP Wemos deep sleep. Wakes up and starts the complete sketch so it makes no sense to make a loop here } void DisplayForecast(){ // Display is 264x176 resolution //display.fillScreen(GxEPD_WHITE); display.setTextColor(GxEPD_BLACK); display.setCursor(0,12); DisplayWXicon(14,15, Icon0); DisplayWXicon(77,0, "thermo"); DisplayWXicon(139,0, "probrain"); //display.setTextColor(GxEPD_RED); display.setCursor(176,12); display.println(Day0); display.setFont(NULL); display.setCursor(233,23); display.println(currentTime); // HH:mm display.setTextColor(GxEPD_BLACK); display.setCursor(75,42); display.println(Conditions0); display.setFont(&FreeSans9pt7b); display.setCursor(50,40); display.println(High0 + "/" + Low0); display.setCursor(105,40); display.println(Averagehumidity0 + "%"); display.setCursor(148,40); display.println(Pop0 + "%"); DisplayWXicon(13,76, Icon1); DisplayWXicon(75,60, "thermo"); DisplayWXicon(139,60, "probrain"); display.setCursor(175,72); display.println(Day1); display.setFont(NULL); display.setCursor(75,105); display.println(Conditions1); display.setFont(&FreeSans9pt7b); display.setCursor(50,100); display.println(High1 + "/" + Low1); display.setCursor(105,100); display.println(Averagehumidity1 + "%"); display.setCursor(148,100); display.println(Pop1 + "%"); DisplayWXicon(10,142, Icon2); DisplayWXicon(75,118, "thermo"); DisplayWXicon(139,118, "probrain"); display.setCursor(175,132); display.println(Day2); display.setFont(NULL); display.setCursor(75,162); display.println(Conditions2); display.setFont(&FreeSans9pt7b); display.setCursor(50,157); display.println(High2 + "/" + Low2); display.setCursor(105,157); display.println(Averagehumidity2 + "%"); display.setCursor(148,157); display.println(Pop2 + "%"); display.update(); } /* Avialble symbols MostlyCloudy(x,y,scale) MostlySunny(x,y,scale) Rain(x,y,scale) Cloudy(x,y,scale) Sunny(x,y,scale) ExpectRain(x,y,scale) Tstorms(x,y,scale) Snow(x,y,scale) Fog(x,y,scale) Nodata(x,y,scale) */ void DisplayWXicon(int x, int y, String IconName){ int scale = 10; // Adjust size as necessary Serial.println(IconName); if (IconName == "rain" || IconName == "nt_rain") Rain(x,y, scale); else if (IconName == "chancerain" || IconName == "nt_chancerain") ExpectRain(x,y,scale); else if (IconName == "snow" || IconName == "nt_snow" || IconName == "flurries" || IconName == "nt_flurries" || IconName == "chancesnow" || IconName == "nt_chancesnow" || IconName == "chanceflurries" || IconName == "nt_chanceflurries") Snow(x,y,scale); else if (IconName == "sleet" || IconName == "nt_sleet" || IconName == "chancesleet" || IconName == "nt_chancesleet") Snow(x,y,scale); else if (IconName == "sunny" || IconName == "nt_sunny" || IconName == "clear" || IconName == "nt_clear") Sunny(x,y,scale); else if (IconName == "partlysunny" || IconName == "nt_partlysunny" || IconName == "mostlysunny" || IconName == "nt_mostlysunny") MostlySunny(x,y,scale); else if (IconName == "cloudy" || IconName == "nt_cloudy" || IconName == "mostlycloudy" || IconName == "nt_mostlycloudy" || IconName == "partlycloudy" || IconName == "nt_partlycloudy") Cloudy(x,y,scale); else if (IconName == "tstorms" || IconName == "nt_tstorms" || IconName == "chancetstorms" || IconName == "nt_chancetstorms") Tstorms(x,y,scale); else if (IconName == "fog" || IconName == "nt_fog" || IconName == "hazy" || IconName == "nt_hazy") Fog(x,y,scale); else if (IconName == "thermo") display.drawBitmap(x,y, thermo_icon,64,24, GxEPD_BLACK); else if (IconName == "probrain") display.drawBitmap(x,y, probrain_icon,32,24, GxEPD_BLACK); else Nodata(x,y,scale); } String obtain_time() { String host = "slosarek.eu"; String url = "/api/time.php"; // Use WiFiClientSecure class if you need to create TLS connection //WiFiClient httpclient; String request; request = "GET "+url+" HTTP/1.1\r\n"; request += "Accept: */*\r\n"; request += "Host: " +host+ "\r\n"; request += "Connection: close\r\n"; request += "\r\n"; Serial.println(request); if (! client.connect(host, 80)) { Serial.println("connection failed"); client.flush(); client.stop(); return "connection failed"; } client.print(request); //send the http request to the server client.flush(); unsigned long timeout = millis(); while (client.available() == 0) { if (millis() - timeout > 5000) { Serial.println(">>> Client Timeout !"); client.stop(); return "Client timeout"; } } bool skip_headers = true; String rx_line; String response; // Read all the lines of the reply from server and print them to Serial while(client.available()){ rx_line = client.readStringUntil('\r'); if (rx_line.length() <= 1) { // a blank line denotes end of headers skip_headers = false; } // Collect http response if (!skip_headers) { response += rx_line; } } response.trim(); return response; } void obtain_forecast (String forecast_type) { static char RxBuf[8704]; String request; request = "GET /api/" + API_key + "/"+ forecast_type + "/q/" + Country + "/" + City + ".json HTTP/1.1\r\n"; request += F("User-Agent: Weather Webserver v"); request += version; request += F("\r\n"); request += F("Accept: */*\r\n"); request += "Host: " + String(wxserver) + "\r\n"; request += F("Connection: close\r\n"); request += F("\r\n"); Serial.println(request); Serial.print(F("Connecting to ")); Serial.println(wxserver); WiFiClient httpclient; if (!httpclient.connect(wxserver, 80)) { Serial.println(F("connection failed")); httpclient.flush(); httpclient.stop(); return; } httpclient.print(request); //send the http request to the server httpclient.flush(); // Collect http response headers and content from Weather Underground, discarding HTTP headers, the content is JSON formatted and will be returned in RxBuf. uint16_t respLen = 0; bool skip_headers = true; String rx_line; while (httpclient.connected() || httpclient.available()) { if (skip_headers) { rx_line = httpclient.readStringUntil('\n'); //Serial.println(rx_line); if (rx_line.length() <= 1) { // a blank line denotes end of headers skip_headers = false; } } else { int bytesIn; bytesIn = httpclient.read((uint8_t *)&RxBuf[respLen], sizeof(RxBuf) - respLen); //Serial.print(F("bytesIn ")); Serial.println(bytesIn); if (bytesIn > 0) { respLen += bytesIn; if (respLen > sizeof(RxBuf)) respLen = sizeof(RxBuf); } else if (bytesIn < 0) { Serial.print(F("read error ")); Serial.println(bytesIn); } } delay(1); } httpclient.stop(); if (respLen >= sizeof(RxBuf)) { Serial.print(F("RxBuf overflow ")); Serial.println(respLen); delay(1000); return; } RxBuf[respLen++] = '\0'; // Terminate the C string Serial.print(F("respLen ")); Serial.println(respLen); Serial.println(RxBuf); if (forecast_type == "forecast"){ showWeather_forecast(RxBuf); } if (forecast_type == "astronomy"){ showWeather_astronomy(RxBuf); } } bool showWeather_astronomy(char *json) { StaticJsonBuffer<1*1024> jsonBuffer; char *jsonstart = strchr(json, '{'); // Skip characters until first '{' found //Serial.print(F("jsonstart ")); Serial.println(jsonstart); if (jsonstart == NULL) { Serial.println(F("JSON data missing")); return false; } json = jsonstart; // Parse JSON JsonObject& root = jsonBuffer.parseObject(json); if (!root.success()) { Serial.println(F("jsonBuffer.parseObject() failed")); return false; } // Extract weather info from parsed JSON JsonObject& current = root["moon_phase"]; String percentIlluminated = current["percentIlluminated"]; String phaseofMoon = current["phaseofMoon"]; int SRhour = current["sunrise"]["hour"]; int SRminute = current["sunrise"]["minute"]; int SShour = current["sunset"]["hour"]; int SSminute = current["sunset"]["minute"]; int MRhour = current["moonrise"]["hour"]; int MRminute = current["moonrise"]["minute"]; int MShour = current["moonset"]["hour"]; int MSminute = current["moonset"]["minute"]; Sunrise = (SRhour<10?"0":"")+String(SRhour)+":"+(SRminute<10?"0":"")+String(SRminute); Sunset = (SShour<10?"0":"")+String(SShour)+":"+(SSminute<10?"0":"")+String(SSminute); Moonrise = (MRhour<10?"0":"")+String(MRhour)+":"+(MRminute<10?"0":"")+String(MRminute); Moonset = (MShour<10?"0":"")+String(MShour)+":"+(MSminute<10?"0":"")+String(MSminute); Moonlight = percentIlluminated; DphaseofMoon = phaseofMoon; return true; } bool showWeather_forecast(char *json) { DynamicJsonBuffer jsonBuffer(8704); char *jsonstart = strchr(json, '{'); Serial.print(F("jsonstart ")); Serial.println(jsonstart); if (jsonstart == NULL) { Serial.println(F("JSON data missing")); return false; } json = jsonstart; // Parse JSON JsonObject& root = jsonBuffer.parseObject(json); if (!root.success()) { Serial.println(F("jsonBuffer.parseObject() failed")); return false; } JsonObject& forecast = root["forecast"]["simpleforecast"]; String wday0 = forecast["forecastday"][0]["date"]["weekday_short"]; WDay0 = wday0; int day0 = forecast["forecastday"][0]["date"]["day"]; day0<10?(Day0="0"+String(day0)):(Day0=String(day0)); String mon0 = forecast["forecastday"][0]["date"]["monthname_short"]; String year0 = forecast["forecastday"][0]["date"]["year"]; Day0 += "-" + mon0 + "-" + year0.substring(2); String icon0 = forecast["forecastday"][0]["icon"]; Icon0 = icon0; String high0 = forecast["forecastday"][0]["high"]["celsius"]; High0 = high0; String low0 = forecast["forecastday"][0]["low"]["celsius"]; Low0 = low0; String conditions0 = forecast["forecastday"][0]["conditions"]; Conditions0 = conditions0; String pop0 = forecast["forecastday"][0]["pop"]; Pop0 = pop0; String averagehumidity0 = forecast["forecastday"][0]["avehumidity"]; Averagehumidity0 = averagehumidity0; String wday1 = forecast["forecastday"][1]["date"]["weekday_short"]; WDay1 = wday1; int day1 = forecast["forecastday"][1]["date"]["day"]; day1<10?(Day1="0"+String(day1)):(Day1=String(day1)); String mon1 = forecast["forecastday"][1]["date"]["monthname_short"]; String year1 = forecast["forecastday"][1]["date"]["year"]; Day1 += "-" + mon1 + "-" + year1.substring(2); String icon1 = forecast["forecastday"][1]["icon"]; Icon1 = icon1; String high1 = forecast["forecastday"][1]["high"]["celsius"]; High1 = high1; String low1 = forecast["forecastday"][1]["low"]["celsius"]; Low1 = low1; String conditions1 = forecast["forecastday"][1]["conditions"]; Conditions1 = conditions1; String pop1 = forecast["forecastday"][1]["pop"]; Pop1 = pop1; String averagehumidity1 = forecast["forecastday"][1]["avehumidity"]; Averagehumidity1 = averagehumidity1; String wday2 = forecast["forecastday"][2]["date"]["weekday_short"]; WDay2 = wday2; int day2 = forecast["forecastday"][2]["date"]["day"]; day2<10?(Day2="0"+String(day2)):(Day2=String(day2)); String mon2 = forecast["forecastday"][2]["date"]["monthname_short"]; String year2 = forecast["forecastday"][2]["date"]["year"]; Day2 += "-" + mon2 + "-" + year2.substring(2); String icon2 = forecast["forecastday"][2]["icon"]; Icon2 = icon2; String high2 = forecast["forecastday"][2]["high"]["celsius"]; High2 = high2; String low2 = forecast["forecastday"][2]["low"]["celsius"]; Low2 = low2; String conditions2 = forecast["forecastday"][2]["conditions"]; Conditions2 = conditions2; String pop2 = forecast["forecastday"][2]["pop"]; Pop2 = pop2; String averagehumidity2 = forecast["forecastday"][2]["avehumidity"]; Averagehumidity2 = averagehumidity2; String wday3 = forecast["forecastday"][3]["date"]["weekday_short"]; WDay3 = wday3; int day3 = forecast["forecastday"][3]["date"]["day"]; day3<10?(Day3="0"+String(day3)):(Day3=String(day3)); String mon3 = forecast["forecastday"][3]["date"]["monthname_short"]; String year3 = forecast["forecastday"][3]["date"]["year"]; Day3 += "-" + mon3 + "-" + year3.substring(2); String icon3 = forecast["forecastday"][3]["icon"]; Icon3 = icon3; String high3 = forecast["forecastday"][3]["high"]["celsius"]; High3 = high3; String low3 = forecast["forecastday"][3]["low"]["celsius"]; Low3 = low3; String conditions3 = forecast["forecastday"][3]["conditions"]; Conditions3 = conditions3; String pop3 = forecast["forecastday"][3]["pop"]; Pop3 = pop3; String averagehumidity3 = forecast["forecastday"][3]["avehumidity"]; Averagehumidity3 = averagehumidity3; return true; } int StartWiFi(const char* ssid, const char* password){ int connAttempts = 0; Serial.println("\r\nConnecting to: "+String(ssid)); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED ) { delay(500); Serial.print("."); if(connAttempts > 20) return -5; connAttempts++; } Serial.println("WiFi connected\r\nIP address: "); Serial.println(WiFi.localIP()); // Set up mDNS responder: // - first argument is the domain name, in this example // the fully-qualified domain name is "esp8266.local" // - second argument is the IP address to advertise // we send our IP address on the WiFi network if (!MDNS.begin(domainName)) { Serial.println("Error setting up MDNS responder!"); while(1) { delay(1000); } } Serial.println("mDNS responder started"); // Start TCP (HTTP) server server.begin(); Serial.println("TCP server started"); // Add service to MDNS-SD MDNS.addService("http", "tcp", 80); return 1; } void clear_screen() { display.fillScreen(GxEPD_WHITE); display.update(); } //########################################################################### // Symbols are drawn on a relative 10x15 grid and 1 scale unit = 1 drawing unit void addcloud(int x, int y, int scale) { int linesize = 3; //Draw cloud outer display.fillCircle(x-scale*3, y, scale, GxEPD_BLACK); // Left most circle display.fillCircle(x+scale*3, y, scale, GxEPD_BLACK); // Right most circle display.fillCircle(x-scale, y-scale, scale*1.4, GxEPD_BLACK); // left middle upper circle display.fillCircle(x+scale*1.5, y-scale*1.3, scale*1.75, GxEPD_BLACK); // Right middle upper circle display.fillRect(x-scale*3, y-scale, scale*6, scale*2+1,GxEPD_BLACK); // Upper and lower lines //Clear cloud inner display.fillCircle(x-scale*3, y, scale-linesize, GxEPD_WHITE); // Clear left most circle display.fillCircle(x+scale*3, y, scale-linesize, GxEPD_WHITE); // Clear right most circle display.fillCircle(x-scale, y-scale, scale*1.4-linesize, GxEPD_WHITE); // left middle upper circle display.fillCircle(x+scale*1.5, y-scale*1.3, scale*1.75-linesize, GxEPD_WHITE); // Right middle upper circle display.fillRect(x-scale*3, y-scale+linesize, scale*6, scale*2-linesize*2+1, GxEPD_WHITE); // Upper and lower lines } void addrain(int x, int y, int scale){ y = y + scale/2; for (int i = 0; i < 6; i++){ display.drawLine(x-scale*4+scale*i*1.3+0, y+scale*1.9, x-scale*3.5+scale*i*1.3+0, y+scale,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.3+1, y+scale*1.9, x-scale*3.5+scale*i*1.3+1, y+scale,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.3+2, y+scale*1.9, x-scale*3.5+scale*i*1.3+2, y+scale,GxEPD_BLACK); } } void addsnow(int x, int y, int scale){ int dxo, dyo, dxi, dyi; for (int flakes = 0; flakes < 5;flakes++){ for (int i = 0; i <360; i = i + 45) { dxo = 0.5*scale * cos((i-90)*3.14/180); dxi = dxo*0.1; dyo = 0.5*scale * sin((i-90)*3.14/180); dyi = dyo*0.1; display.drawLine(dxo+x+0+flakes*1.5*scale-scale*3,dyo+y+scale*2,dxi+x+0+flakes*1.5*scale-scale*3,dyi+y+scale*2,GxEPD_BLACK); } } } void addtstorm(int x, int y, int scale){ y = y + scale/2; for (int i = 0; i < 5; i++){ display.drawLine(x-scale*4+scale*i*1.5+0, y+scale*1.5, x-scale*3.5+scale*i*1.5+0, y+scale,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.5+1, y+scale*1.5, x-scale*3.5+scale*i*1.5+1, y+scale,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.5+2, y+scale*1.5, x-scale*3.5+scale*i*1.5+2, y+scale,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.5, y+scale*1.5+0, x-scale*3+scale*i*1.5+0, y+scale*1.5+0,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.5, y+scale*1.5+1, x-scale*3+scale*i*1.5+0, y+scale*1.5+1,GxEPD_BLACK); display.drawLine(x-scale*4+scale*i*1.5, y+scale*1.5+2, x-scale*3+scale*i*1.5+0, y+scale*1.5+2,GxEPD_BLACK); display.drawLine(x-scale*3.5+scale*i*1.4+0, y+scale*2.5, x-scale*3+scale*i*1.5+0, y+scale*1.5,GxEPD_BLACK); display.drawLine(x-scale*3.5+scale*i*1.4+1, y+scale*2.5, x-scale*3+scale*i*1.5+1, y+scale*1.5,GxEPD_BLACK); display.drawLine(x-scale*3.5+scale*i*1.4+2, y+scale*2.5, x-scale*3+scale*i*1.5+2, y+scale*1.5,GxEPD_BLACK); } } void addsun(int x, int y, int scale) { int linesize = 3; int dxo, dyo, dxi, dyi; display.fillCircle(x, y, scale,GxEPD_BLACK); display.fillCircle(x, y, scale-linesize,GxEPD_WHITE); for (float i = 0; i <360; i = i + 45) { dxo = 2.2*scale * cos((i-90)*3.14/180); dxi = dxo * 0.6; dyo = 2.2*scale * sin((i-90)*3.14/180); dyi = dyo * 0.6; if (i == 0 || i == 180) { display.drawLine(dxo+x-1,dyo+y,dxi+x-1,dyi+y,GxEPD_BLACK); display.drawLine(dxo+x+0,dyo+y,dxi+x+0,dyi+y,GxEPD_BLACK); display.drawLine(dxo+x+1,dyo+y,dxi+x+1,dyi+y,GxEPD_BLACK); } if (i == 90 || i == 270) { display.drawLine(dxo+x,dyo+y-1,dxi+x,dyi+y-1,GxEPD_BLACK); display.drawLine(dxo+x,dyo+y+0,dxi+x,dyi+y+0,GxEPD_BLACK); display.drawLine(dxo+x,dyo+y+1,dxi+x,dyi+y+1,GxEPD_BLACK); } if (i == 45 || i == 135 || i == 225 || i == 315) { display.drawLine(dxo+x-1,dyo+y,dxi+x-1,dyi+y,GxEPD_BLACK); display.drawLine(dxo+x+0,dyo+y,dxi+x+0,dyi+y,GxEPD_BLACK); display.drawLine(dxo+x+1,dyo+y,dxi+x+1,dyi+y,GxEPD_BLACK); } } } void addfog(int x, int y, int scale){ int linesize = 4; for (int i = 0; i < 5; i++){ display.fillRect(x-scale*3, y+scale*1.5, scale*6, linesize, GxEPD_BLACK); display.fillRect(x-scale*3, y+scale*2, scale*6, linesize, GxEPD_BLACK); display.fillRect(x-scale*3, y+scale*2.5, scale*6, linesize, GxEPD_BLACK); } } void MostlyCloudy(int x, int y, int scale){ addsun(x-scale*1.8,y-scale*1.8,scale); addcloud(x,y,scale); } void MostlySunny(int x, int y, int scale){ addcloud(x,y,scale); addsun(x-scale*1.8,y-scale*1.8,scale); } void Rain(int x, int y, int scale){ addcloud(x,y,scale); addrain(x,y,scale); } void Cloudy(int x, int y, int scale){ addcloud(x,y,scale); } void Sunny(int x, int y, int scale){ scale = scale * 1.5; addsun(x,y,scale); } void ExpectRain(int x, int y, int scale){ addsun(x-scale*1.8,y-scale*1.8,scale); addcloud(x,y,scale); addrain(x,y,scale); } void Tstorms(int x, int y, int scale){ addcloud(x,y,scale); addtstorm(x,y,scale); } void Snow(int x, int y, int scale){ addcloud(x,y,scale); addsnow(x,y,scale); } void Fog(int x, int y, int scale){ addcloud(x,y,scale); addfog(x,y,scale); } void handle_http_not_found() { server.send(404, "text/plain", "Not Found"); } void handle_http_root() { String headers = "<head><link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\">"; headers += "<meta name='viewport' content='width=device-width,initial-scale=1'></head>"; String html = "<body><div class='container-fluid'><div class='row'>"; html += "<div class='col-md-6'><h4>carlos.local</h4><br>"; html += "<h5>Message to Display:</h5>"; html += "<br><form action='/lcd-write' target='frame' method='POST'>"; html += "<textarea name='text' rows=6 class='form-control'></textarea>"; html += "<input type='submit' value='Send to display' class='btn btn-success'><form><br>"; html += "</div></div></div></body>"; html += "<iframe name='frame'></iframe>"; server.send(200, "text/html", headers + html); } void Nodata(int x, int y, int scale){ if (scale == 10) display.setTextSize(3); else display.setTextSize(1); display.setCursor(x,y); display.println("?"); display.setTextSize(1); } void handleLcdWrite() { display.fillScreen(GxEPD_WHITE); display.setCursor(0,12); // Analizo el POST iterando cada value if (server.args() > 0) { for (byte i = 0; i < server.args(); i++) { if (server.argName(i) == "text") { display.print(server.arg(i)); } } } display.update(); server.send(200, "text/html", "Texto enviado al display"); } void loop() { // Add milisec comparison to make server work for 1 min / 90 sec if (millis() < serverDownTime) { server.handleClient(); } else { Serial.println(" Server going down"); display.powerDown(); ESP.deepSleep(0); } }
44.111607
194
0.640117
true
9,570
9a7b4aac5ea5723a3c4638d41ab612585453ce9e
2,126
ino
Arduino
examples/CustomChineseFont/CustomChineseFont.ino
chocotov1/Tiny4kOLED
a6adfff96c224379f8e196785e6981fb571ad55c
[ "MIT" ]
170
2017-07-22T11:20:22.000Z
2022-03-27T11:36:56.000Z
examples/CustomChineseFont/CustomChineseFont.ino
chocotov1/Tiny4kOLED
a6adfff96c224379f8e196785e6981fb571ad55c
[ "MIT" ]
42
2018-03-23T02:06:31.000Z
2022-03-20T09:24:13.000Z
examples/CustomChineseFont/CustomChineseFont.ino
chocotov1/Tiny4kOLED
a6adfff96c224379f8e196785e6981fb571ad55c
[ "MIT" ]
30
2018-04-15T04:39:25.000Z
2022-03-16T06:58:13.000Z
/* * Tiny4kOLED - Drivers for SSD1306 controlled dot matrix OLED/PLED 128x32 displays * * Based on ssd1306xled, re-written and extended by Stephen Denne * from 2017-04-25 at https://github.com/datacute/Tiny4kOLED * */ // Choose your I2C implementation before including Tiny4kOLED.h // The default is selected is Wire.h // To use the Wire library: //#include <Wire.h> // To use the Adafruit's TinyWireM library: //#include <TinyWireM.h> // To use the TinyI2C library from https://github.com/technoblogy/tiny-i2c //#include <TinyI2CMaster.h> // The blue OLED screen requires a long initialization on power on. // The code to wait for it to be ready uses 20 bytes of program storage space // If you are using a white OLED, this can be reclaimed by uncommenting // the following line (before including Tiny4kOLED.h): //#define TINY4KOLED_QUICK_BEGIN #include <Tiny4kOLED.h> #include "font16x16cn.h" // ============================================================================ void setup() { // put your setup code here, to run once: oled.begin(); // Two rotations are supported, // The begin() method sets the rotation to 1. //oled.setRotation(0); // Some newer devices do not contain an external current reference. // Older devices may also support using the internal curret reference, // which provides more consistent brightness across devices. // The internal current reference can be configured as either low current, or high current. // Using true as the parameter value choses the high current internal current reference, // resulting in a brighter display, and a more effective contrast setting. //oled.setInternalIref(true); // Two fonts are supplied with this library, FONT8X16 and FONT6X8 // Other fonts are available from the TinyOLED-Fonts library // This example shows how to create and use your own font. // The font used here is of five chinese characters. oled.setFont(&TinyOLED4kfont16x16cn); oled.clear(); oled.setCursor(10, 1); oled.print(F("01234")); oled.on(); } void loop() { // put your main code here, to run repeatedly: delay(10000); }
33.21875
93
0.706491
true
533
94c77b4fe18ba8c5812b3e6dc6a7ba98edf30031
9,276
ino
Arduino
Chute-2017-aug23.ino
joeladria/chute
7bd5e36baa73ee6f198492839834b1a229e198ba
[ "Apache-2.0" ]
null
null
null
Chute-2017-aug23.ino
joeladria/chute
7bd5e36baa73ee6f198492839834b1a229e198ba
[ "Apache-2.0" ]
null
null
null
Chute-2017-aug23.ino
joeladria/chute
7bd5e36baa73ee6f198492839834b1a229e198ba
[ "Apache-2.0" ]
0
null
null
// Chute - no bluetooth required! // Joel Adria // Based on RemoteLEDSender ICSC Example // v1.1 // Aug 23, 2017 // /Users/joeladria/Dropbox/Work/Nova\ Digital\ Parachute/Code/uploadAll.sh /Users/joeladria/Documents/Arduino/Chute-2017-aug23/Chute-2017-aug23.ino.with_bootloader.micro.hex // Wind chimes: 280.3 Hz, 396.4 Hz, 420,0 Hz 529.1, 560.6 #include <Wire.h> #include <SPI.h> #include <ICSC.h> #include <EEPROM.h> #include <anyrtttl.h> #include <binrtttl.h> #include <pitches.h> #include <Adafruit_LIS3DH.h> #include <Adafruit_Sensor.h> const char * twinkle = "Twinkle:d=4,o=5,b=80:32p,16p,16c,16p,16c,16p,16g,16p,16g,16p,16a,16p,16a,16p,4g,16f,16p,16f,16p,16e,16p,16e,16p,16d,16p,16g,16p,16c6"; int emajor[12] = {NOTE_C4, NOTE_E4, NOTE_G4, NOTE_C5, NOTE_E5, NOTE_G5, NOTE_C6, NOTE_E6}; // 12 notes int echroma[12] = {659, 698, 740, 784, 831, 880, 932, 988, 1047, 1109, 1175, 1245}; // 12 notes int powerTimer = 12; #include <FastLED.h> FASTLED_USING_NAMESPACE #define FRAMES_PER_SECOND 120 #if FASTLED_VERSION < 3001000 #error "Requires FastLED 3.1 or later; check github for latest code." #endif #define LED_PIN 6 #define NUM_LEDS 12 #define BRIGHTNESS 255 #define LED_TYPE WS2812 #define COLOR_ORDER GRB CRGB leds[NUM_LEDS]; #define UPDATES_PER_SECOND 100 uint8_t chuteID = EEPROM.read(0); ICSC icsc(Serial1, chuteID, 5); static unsigned long ts = millis(); Adafruit_LIS3DH lis = Adafruit_LIS3DH(); bool powerOn = 1; void setup() { Serial.println(chuteID); delay(1000); // 1 second delay for recovery FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); // for ChuteNet Serial1.begin(19200); // for debug Serial.begin(9600); icsc.begin(); icsc.registerCommand('A', &modeChange); icsc.registerCommand('B', &modeChange); icsc.registerCommand('C', &modeChange); icsc.registerCommand('D', &modeChange); icsc.registerCommand('E', &modeChange); icsc.registerCommand('F', &modeChange); icsc.registerCommand('G', &modeChange); icsc.registerCommand('H', &modeChange); icsc.registerCommand('I', &modeChange); icsc.registerCommand('T', &modeChange); icsc.registerCommand('P', &modeChange); icsc.registerCommand('X', &speedChange); // accel start if (! lis.begin(0x18)) { // change this to 0x19 for alternative i2c address Serial.println("Couldn't connect to accel"); while (1) { tone(9, 200); delay(1000); noTone(9); delay(1000); } } lis.setRange(LIS3DH_RANGE_4_G); // 2, 4, 8 or 16 G! // ready to go // tone(9, NOTE_B5, 100); // delay(100); // tone(9, NOTE_E6, 850); // delay(800); // noTone(9); } // List of patterns to cycle through. Each is defined as a separate function below. typedef void (*SimplePatternList[])(); SimplePatternList gPatterns = { test, // T 0 accelGame, // A 1 -- charge up colours ocean, // B 2 -- white dots jumping out from handles mushroom, // C 3 -- bursts from centre pinwheel, // D 4 -- rainbow rotate fireworks, // E 5 -- spiral formation starfield, // F 6 -- rainbow, // G 7 -- rainbow from middle stix, // H 8 confetti, // I 9 powerOff, // poweroff 10 }; // uint8_t gCurrentPatternNumber = 6; // Index number of which pattern is current uint8_t gHue = 0; // rotating "base color" used by many of the patterns float accelVariation; uint8_t maxForce = 0; uint8_t localTimer = 0; float runningAverage = 0; bool latch; bool holdDown; static unsigned long latchTimer = millis(); static unsigned long sensorTimer = millis(); static unsigned long fxTimer = millis(); uint8_t latchTimeout = 250; // msM uint8_t fxSpeed = 255; // value from 0-255, controllable from RGB thingy? sensors_event_t event; void loop() { // 1. process networking icsc.process(); // 4. process local sensor if ((millis() - sensorTimer) > 100) { lis.getEvent(&event); sensorTimer = millis(); } /* Display the results (acceleration is measured in m/s^2) */ // // Serial.print("\t\tX: "); Serial.print(event.acceleration.x); // Serial.print(" \tY: "); Serial.print(event.acceleration.y); // Serial.print(" \tZ: "); Serial.print(event.acceleration.z); // Serial.println(" m/s^2 "); // check sum of all motion float sum = abs(event.acceleration.z) + abs(event.acceleration.y) + abs(event.acceleration.x); // see if our sum is deviating from the average accelVariation = abs(runningAverage - sum); // Serial.print(" difference from average: "); // Serial.print(accelVariation); // calculate the average afterwards to avoid skewing the result runningAverage = (runningAverage + sum) / 2; // Serial.print("runningAverage: "); // Serial.print(runningAverage); // see latch if we're in the threshold. maybe needs a timeout vs an average-out? // Serial.print((millis() - latchTimer)); if ((millis() - latchTimer) < latchTimeout) { holdDown = 1; } else { holdDown = 0; } if (accelVariation > 5 && holdDown != 1) { // leave on for 18ms -> this should work itself out with runningAverage, then keep off for 500ms latch = 1; latchTimer = millis(); } // Serial.print(" latch: "); // Serial.println(latch); // 6. update LEDs (every 17ms = 60fps) EVERY_N_MILLISECONDS(17) { gPatterns[gCurrentPatternNumber](); // keep a blue led on all the time to keep power // this could probably use some logic (if LED sum is less than, then don't do this) But this is safer... if (powerOn) { leds[0] |= CRGB( 0, 0, 255); } FastLED.show(); latch = 0; } EVERY_N_MILLISECONDS( 50 ) { localTimer++; gHue = localTimer; } // 7. update piezo anyrtttl::nonblocking::play(); } void clockSync(char *data, unsigned char len) { // Serial.print(" Incoming timer:"); // for (uint8_t i = 0; i < len; i++) { // Serial.print(data[i]); // } // // Serial.print(" Casting:"); int intTimer = atoi(data); // Serial.print(intTimer); // // Serial.print(" Local timer:"); // Serial.print(localTimer); // // int delta = localTimer - intTimer; // Serial.print(" Variance:"); // Serial.println(delta); localTimer = intTimer; } int headingStrip; int progressTimer = 0; void modeChange(unsigned char src, char command, unsigned char len, char *data) { Serial.print("Packet from "); Serial.print(src); Serial.print("Received MODE signal"); switch (command) { case 'P': gCurrentPatternNumber = 10; Serial.println("Powering off..."); break; case 'T': powerTimer = 12; clockSync(data, len); gCurrentPatternNumber = 0; tone(9, NOTE_A3); delay(10); noTone(9); if ((localTimer % 10) + 1 == chuteID) { } Serial.println("In test mode..."); break; // compass mode case 'D': if (gCurrentPatternNumber != (int(command) - 64)) { tone(9, NOTE_A3); delay(30); noTone(9); } gCurrentPatternNumber = int(command) - 64; Serial.print(" Current mode: "); Serial.println(gCurrentPatternNumber); headingStrip = atoi(data); break; case 'B': // accelGame/Mushroom // if we change modes, then we want to go into normal "accel" mode with no clock. if (gCurrentPatternNumber != (int(command) - 64)) { gHue = 0; } progressTimer = atoi(data); clockSync(data, len); gCurrentPatternNumber = int(command) - 64; Serial.print(" Current mode: "); Serial.println(gCurrentPatternNumber); Serial.print(" Progres timer: "); Serial.println(progressTimer); break; default: // a = 1, b = 2, etc... http://www.kerryr.net/pioneers/ascii2.htm clockSync(data, len); if (gCurrentPatternNumber != (int(command) - 64)) { powerTimer = 12; tone(9, NOTE_A3); delay(30); noTone(9); if (command == 'F') { // play twinkle twinkle // anyrtttl::nonblocking::begin(9, twinkle); } } gCurrentPatternNumber = int(command) - 64; Serial.print(" Current mode: "); Serial.println(gCurrentPatternNumber); break; } // stats_t *duck = icsc.stats(); // // Serial.print("TX Fail:"); // Serial.print(duck->tx_fail); // Serial.print(" CS Errors:"); // Serial.print(duck->tx_bytes); // Serial.print(" TX Bytes:"); // Serial.print(duck->tx_bytes); // Serial.print(" RX Packs:"); // Serial.print(duck->rx_packets); // Serial.print(" RX Bytes:"); // Serial.print(duck->rx_bytes); // Serial.print(" CS Errors:"); // Serial.print(duck->cs_errors); // Serial.print(" CS Run:"); // Serial.print(duck->cb_run); // Serial.print(" CS Bad:"); // Serial.print(duck->cb_bad); // Serial.print(" Collision:"); // Serial.print(duck->collision); // Serial.print(" OOB:"); // Serial.println(duck->oob_bytes); } void speedChange(unsigned char src, char command, unsigned char len, char *data) { Serial.print(" Incoming speed:"); for (uint8_t i = 0; i < len; i++) { Serial.print(data[i]); } Serial.print(" Casting:"); fxSpeed = atoi(data); Serial.print(fxSpeed); }
25.138211
174
0.635295
true
2,797
b68c7181e625af6d99cb8be101e95396926a540e
1,630
ino
Arduino
motor_controls/control1/control1.ino
miteshkumar77/pill_dispenser
3ed61efb862a2f61cc9cb9cb0676ad0fccea4b97
[ "MIT" ]
2
2020-03-30T05:44:29.000Z
2020-04-10T02:40:39.000Z
motor_controls/control1/control1.ino
miteshkumar77/pill_dispenser
3ed61efb862a2f61cc9cb9cb0676ad0fccea4b97
[ "MIT" ]
null
null
null
motor_controls/control1/control1.ino
miteshkumar77/pill_dispenser
3ed61efb862a2f61cc9cb9cb0676ad0fccea4b97
[ "MIT" ]
0
null
null
#include <Arduino.h> #include "A4988.h" #define STEP 3 #define DIR 4 #define FULL 200 #define SPEED 60 #define MS1 5 #define MS2 6 #define MS3 7 #define FULL_ANGLE 360 #define SECTORS 5 const int delta = FULL_ANGLE/SECTORS; /** * Sequences: * * SECTORS is defined as 5 above. So each * dispensing bins are 360/5 = 70 degrees apart * Given a sequence, the motor will turn to those * angles in that order. Taking the shortest path * to get there. */ //int sequence[5] = {3, 1, 2, 4, 3}; /** * To test: input a sequence len, and then * enter an array with that many elements from * 0 to 'SECTORS' - 1 as defined above. * * 0 is the home position, or the position that the * servo motor starts from. */ const int sequence_len = 5; int sequence[sequence_len] = {1, 4, 3, 1, 3}; int current_pos; void go_to_angle(int a); int compute_min(int a1, int a2); A4988 stepper1(FULL, DIR, STEP, MS1, MS2, MS3); void setup() { delay(5000); current_pos = 0; stepper1.begin(20, 1); delay(1000); } void go_to_angle(int a) { stepper1.rotate(compute_min(current_pos, a) * delta); current_pos = a; } void go_home() { go_to_angle(0); } int compute_min(int a1, int a2) { int cw = a2 - a1; int ccw = a1 - a2; if (ccw < 0) { ccw += SECTORS; } else if (cw < 0) { cw += SECTORS; } if (ccw < cw) { return ccw; } else { return -cw; } } void loop() { for (int i = 0; i < 5; ++i) { go_to_angle(sequence[i]); delay(5000); } go_home(); while(1); }
18.953488
57
0.582209
true
542
8f8153fbbee5ca4d254431eaf7f8e28b36a990bf
962
ino
Arduino
fabricioOcarina/fabricioOcarina.ino
FabricioCapistrano/arduino
38f53d422ce6573962501f089a28ceaad6a36f2a
[ "MIT" ]
null
null
null
fabricioOcarina/fabricioOcarina.ino
FabricioCapistrano/arduino
38f53d422ce6573962501f089a28ceaad6a36f2a
[ "MIT" ]
null
null
null
fabricioOcarina/fabricioOcarina.ino
FabricioCapistrano/arduino
38f53d422ce6573962501f089a28ceaad6a36f2a
[ "MIT" ]
0
null
null
#define cima 13 #define baixo 12 #define esquerda 11 #define direita 10 #define aButton 9 #define bButton 8 void setup() { // put your setup code here, to run once: pinMode(cima, INPUT_PULLUP); pinMode(baixo, INPUT_PULLUP); pinMode(esquerda, INPUT_PULLUP); pinMode(direita, INPUT_PULLUP); pinMode(aButton, INPUT_PULLUP); pinMode(bButton, INPUT_PULLUP); pinMode(5, OUTPUT); } void loop() { if(digitalRead(cima) == LOW){ tone(5, 261); noTone(5); } else if(digitalRead(direita) == LOW){ tone(5, 293); noTone(5); } else if(digitalRead(esquerda) == LOW){ tone(5, 329); noTone(5); } else if(digitalRead(direita) == LOW){ tone(5, 349); noTone(5); } else if(digitalRead(aButton) == LOW){ tone(5, 392); noTone(5); } else if(digitalRead(bButton) == LOW){ tone(5, 429); noTone(5); } // put your main code here, to run repeatedly: }
20.468085
48
0.598753
true
312
0a8389b6cbd29110897c5fafef1232c36789f285
22,119
ino
Arduino
_08_Low_Latency_Logger_with_GPS/_08_Low_Latency_Logger_with_GPS.ino
jeremy-daily/Teensy-Crash-EDR
736e958161124e3c1423da24b29054d7ca2dd53f
[ "MIT" ]
2
2017-10-21T03:04:11.000Z
2018-08-10T08:38:12.000Z
_08_Low_Latency_Logger_with_GPS/_08_Low_Latency_Logger_with_GPS.ino
jeremy-daily/Teensy-Crash-EDR
736e958161124e3c1423da24b29054d7ca2dd53f
[ "MIT" ]
1
2017-04-17T16:25:09.000Z
2017-04-17T16:25:09.000Z
_08_Low_Latency_Logger_with_GPS/_08_Low_Latency_Logger_with_GPS.ino
jeremy-daily/Teensy-Crash-EDR
736e958161124e3c1423da24b29054d7ca2dd53f
[ "MIT" ]
2
2016-09-18T23:58:44.000Z
2018-04-12T02:41:08.000Z
/** * This program logs data to a binary file. Functions are included * to convert the binary file to a csv text file. * * Samples are logged at regular intervals. The maximum logging rate * depends on the quality of your SD card and the time required to * read sensor data. This example has been tested at 500 Hz with * good SD card on an Uno. 4000 HZ is possible on a Due. * * If your SD card has a long write latency, it may be necessary to use * slower sample rates. Using a Mega Arduino helps overcome latency * problems since 13 512 byte buffers will be used. * * Data is written to the file using a SD multiple block write command. */ // log file base name. Must be five characters or less. #define FILE_BASE_NAME "DATA" #include <SPI.h> #include <SdFat.h> #include <SdFatUtil.h> #include <FlexCAN.h> #include "kinetis_flexcan.h" #include <TimeLib.h> #include <TinyGPS.h> TimeElements tm; time_t GPStime = 0; //------------------------------------------------------------------------------ // User data functions. Modify these functions for your data items. #include "UserDataType.h" // Edit this include file to change data_t. FlexCAN CANbus(250000); static CAN_message_t rxmsg; IntervalTimer oneSecondReset; elapsedMicros microsecondsPerSecond; elapsedMillis buttonPressTimer; elapsedMillis GPSsampleTimer; TinyGPS gps; boolean gpsEncoded; void resetMicros() { microsecondsPerSecond = 0; //reset the timer } // Acquire a data record. void acquireCANData(data_t* data) { data->timeStamp = now(); data->usec = uint32_t(microsecondsPerSecond); data->type = 0; data->ID = ( 0x00 << 24 ) | rxmsg.id; // let the first byte in the ID data word to be 0 if this is GPS data. data->DLC = rxmsg.len; memset(data->dataField,0xFF,8); for (uint8_t i = 0; i < rxmsg.len; i++){ data->dataField[i] = rxmsg.buf[i]; } } void acquireGPSData(data_t* data) { int GPSyear; byte GPSmonth, GPSday, GPShour, GPSminute, GPSsecond, GPShundredths; unsigned long GPSage; do{ if (Serial1.available()) gps.encode(Serial1.read()); gps.crack_datetime(&GPSyear, &GPSmonth, &GPSday, &GPShour, &GPSminute, &GPSsecond, &GPShundredths, &GPSage); Serial.print(GPShour); Serial.print(":"); Serial.print(GPSminute); Serial.print(":"); Serial.print(GPSsecond); Serial.print(" "); Serial.print(GPSday); Serial.print("-"); Serial.print(GPSmonth); Serial.print("-"); Serial.print(GPSyear); Serial.println(); tm.Second = GPSsecond; tm.Minute = GPSminute; tm.Hour = GPShour; tm.Day = GPSday; tm.Month = GPSmonth; tm.Year = GPSyear-1970; GPStime = makeTime(tm); } while (GPStime < 1471842557); // int32_t latitude; int32_t longitude; uint32_t fix_age; gps.get_position(&latitude,&longitude,&fix_age); data->timeStamp = now(); data->usec = latitude; //Millionths of a degree data->type = 1; data->ID = GPStime; data->DLC = longitude; data->dataField[0] = (0xFF00 & gps.speed())>>8; data->dataField[1] = 0xFF & gps.speed(); data->dataField[2] = (0xFF00 & gps.course()) >> 8; data->dataField[3] = 0xFF & gps.course(); data->dataField[4] = (0xFF00 & gps.altitude()) >> 8; data->dataField[5] = 0xFF & gps.altitude(); data->dataField[6] = gps.hdop(); data->dataField[7] = gps.satellites(); } // Print a data record. void printData(Print* pr, data_t* data) { int type = data->type; if (type == 0 || type ==1 ){ time_t recordTime = data->timeStamp; char timeString[100]; sprintf(timeString,"%04d-%02d-%02d %02d:%02d:%02d.%06d\t",year(recordTime),month(recordTime),day(recordTime),hour(recordTime),minute(recordTime),second(recordTime),data->usec); pr->print(timeString); sprintf(timeString,"%10d.%06d",data->timeStamp,data->usec); pr->print(timeString); char IDString[11]; sprintf(IDString,"\t%08X\t",data->ID); pr->print(IDString); pr->print(data->DLC); for (int i = 0; i < 8; i++) { char entry[4]; sprintf(entry,"\t%02X",data->dataField[i]); pr->print(entry); } pr->println(); } } // Print data header. void printHeader(Print* pr) { pr->print(F("YYYY-MM-DD HH:MM:SS.usec,")); pr->print(F("Unix timeStamp,")); pr->print(F("ID,")); pr->print(F("DLC")); for (uint8_t i = 0; i < 8; i++) { pr->print(F(",B")); pr->print(i); } pr->println(); } //============================================================================== // Start of configuration constants. //============================================================================== //Interval between data records in microseconds. const uint32_t LOG_INTERVAL_USEC = 250; //------------------------------------------------------------------------------ // Pin definitions. // // SD chip select pin. const uint8_t SD_CS_PIN = 15; // // Digital pin to indicate an error, set to -1 if not used. // The led blinks for fatal errors. The led goes on solid for SD write // overrun errors and logging continues. const uint8_t ERROR_LED_PIN = 21; const uint8_t BUTTON_PIN = 17; //------------------------------------------------------------------------------ // File definitions. // // Maximum file size in blocks. // The program creates a contiguous file with FILE_BLOCK_COUNT 512 byte blocks. // This file is flash erased using special SD commands. The file will be // truncated if logging is stopped early. //const uint32_t FILE_BLOCK_COUNT = 256000; //const uint32_t FILE_BLOCK_COUNT = 2097152; //1 GB const uint32_t FILE_BLOCK_COUNT = 8388607; //4 GB - 512 //------------------------------------------------------------------------------ // Buffer definitions. // // The logger will use SdFat's buffer plus BUFFER_BLOCK_COUNT additional // buffers. // #ifndef RAMEND // Assume ARM. Use total of nine 512 byte buffers. const uint8_t BUFFER_BLOCK_COUNT = 8; // #elif RAMEND < 0X8FF #error Too little SRAM // #elif RAMEND < 0X10FF // Use total of two 512 byte buffers. const uint8_t BUFFER_BLOCK_COUNT = 1; // #elif RAMEND < 0X20FF // Use total of five 512 byte buffers. const uint8_t BUFFER_BLOCK_COUNT = 4; // #else // RAMEND // Use total of 13 512 byte buffers. const uint8_t BUFFER_BLOCK_COUNT = 12; #endif // RAMEND //============================================================================== // End of configuration constants. //============================================================================== // Temporary log file. Will be deleted if a reset or power failure occurs. #define TMP_FILE_NAME "tmp_log.bin" // Size of file base name. Must not be larger than six. const uint8_t BASE_NAME_SIZE = sizeof(FILE_BASE_NAME) - 1; SdFat sd; SdBaseFile binFile; char binName[13] = FILE_BASE_NAME "00.bin"; // Number of data records in a block. const uint16_t DATA_DIM = (512 - 4)/sizeof(data_t); //Compute fill so block size is 512 bytes. FILL_DIM may be zero. const uint16_t FILL_DIM = 512 - 4 - DATA_DIM*sizeof(data_t); struct block_t { uint16_t count; uint16_t overrun; data_t data[DATA_DIM]; uint8_t fill[FILL_DIM]; }; //------------------------------------------------------------------------------ /* * User provided date time callback function. * See SdFile::dateTimeCallback() for usage. */ void dateTime(uint16_t* FATdate, uint16_t* FATtime) { // User gets date and time from GPS or real-time // clock in real callback function // return date using FAT_DATE macro to format fields *FATdate = FAT_DATE(year(), month(), day()); // return time using FAT_TIME macro to format fields *FATtime = FAT_TIME(hour(), minute(), second()); } const uint8_t QUEUE_DIM = BUFFER_BLOCK_COUNT + 2; block_t* emptyQueue[QUEUE_DIM]; uint8_t emptyHead; uint8_t emptyTail; block_t* fullQueue[QUEUE_DIM]; uint8_t fullHead; uint8_t fullTail; // Advance queue index. inline uint8_t queueNext(uint8_t ht) { return ht < (QUEUE_DIM - 1) ? ht + 1 : 0; } //============================================================================== // Error messages stored in flash. #define error(msg) errorFlash(F(msg)) //------------------------------------------------------------------------------ void errorFlash(const __FlashStringHelper* msg) { sd.errorPrint(msg); fatalBlink(); } //------------------------------------------------------------------------------ // void fatalBlink() { while (true) { if (ERROR_LED_PIN >= 0) { digitalWrite(ERROR_LED_PIN, HIGH); delay(80); digitalWrite(ERROR_LED_PIN, LOW); delay(80); } } } //============================================================================== // Convert binary file to csv file. void binaryToCsv() { uint8_t lastPct = 0; block_t block; uint32_t t0 = millis(); uint32_t syncCluster = 0; SdFile csvFile; char csvName[13]; if (!binFile.isOpen()) { Serial.println(); Serial.println(F("No current binary file")); return; } binFile.rewind(); // Create a new csvFile. strcpy(csvName, binName); strcpy(&csvName[BASE_NAME_SIZE + 3], "csv"); if (!csvFile.open(csvName, O_WRITE | O_CREAT | O_TRUNC)) { error("open csvFile failed"); } Serial.println(); Serial.print(F("Writing: ")); Serial.print(csvName); Serial.println(F(" - type any character to stop")); printHeader(&csvFile); uint32_t tPct = millis(); while (!Serial.available() && binFile.read(&block, 512) == 512) { if (Serial1.available()) gps.encode(Serial1.read()); uint16_t i; if (block.count == 0) { break; } if (block.overrun) { csvFile.print(F("OVERRUN,")); csvFile.println(block.overrun); } for (i = 0; i < block.count; i++) { printData(&csvFile, &block.data[i]); } if (csvFile.curCluster() != syncCluster) { csvFile.sync(); syncCluster = csvFile.curCluster(); } if ((millis() - tPct) > 1000) { uint8_t pct = binFile.curPosition()/(binFile.fileSize()/100); if (pct != lastPct) { tPct = millis(); lastPct = pct; Serial.print(pct, DEC); Serial.println('%'); } } if (Serial.available()) { break; } } csvFile.close(); Serial.print(F("Done: ")); Serial.print(0.001*(millis() - t0)); Serial.println(F(" Seconds")); } //------------------------------------------------------------------------------ // read data file and check for overruns void checkOverrun() { bool headerPrinted = false; block_t block; uint32_t bgnBlock, endBlock; uint32_t bn = 0; if (!binFile.isOpen()) { Serial.println(); Serial.println(F("No current binary file")); return; } if (!binFile.contiguousRange(&bgnBlock, &endBlock)) { error("contiguousRange failed"); } binFile.rewind(); Serial.println(); Serial.println(F("Checking overrun errors - type any character to stop")); while (binFile.read(&block, 512) == 512) { if (Serial1.available()) gps.encode(Serial1.read()); if (block.count == 0) { break; } if (block.overrun) { if (!headerPrinted) { Serial.println(); Serial.println(F("Overruns:")); Serial.println(F("fileBlockNumber,sdBlockNumber,overrunCount")); headerPrinted = true; } Serial.print(bn); Serial.print(','); Serial.print(bgnBlock + bn); Serial.print(','); Serial.println(block.overrun); } bn++; } if (!headerPrinted) { Serial.println(F("No errors found")); } else { Serial.println(F("Done")); } } //------------------------------------------------------------------------------ // dump data file to Serial void dumpData() { block_t block; if (!binFile.isOpen()) { Serial.println(); Serial.println(F("No current binary file")); return; } binFile.rewind(); Serial.println(); Serial.println(F("Type any character to stop")); delay(100); printHeader(&Serial); while (!Serial.available() && binFile.read(&block , 512) == 512) { if (Serial1.available()) gps.encode(Serial1.read()); if (block.count == 0) { break; } if (block.overrun) { Serial.print(F("OVERRUN,")); Serial.println(block.overrun); } for (uint32_t i = 0; i < block.count; i++) { printData(&Serial, &block.data[i]); } } Serial.println(F("Done")); } //------------------------------------------------------------------------------ // log data // max number of blocks to erase per erase call uint32_t const ERASE_SIZE = 262144L; void logData() { uint32_t bgnBlock, endBlock; // Allocate extra buffer space. block_t block[BUFFER_BLOCK_COUNT]; block_t* curBlock = 0; Serial.println(); // Find unused file name. if (BASE_NAME_SIZE > 5) { error("FILE_BASE_NAME too long"); } while (sd.exists(binName)) { if (binName[BASE_NAME_SIZE + 1] != '9') { binName[BASE_NAME_SIZE + 1]++; } else { binName[BASE_NAME_SIZE + 1] = '0'; if (binName[BASE_NAME_SIZE] == '9') { error("Can't create file name"); } binName[BASE_NAME_SIZE]++; } } // Delete old tmp file. if (sd.exists(TMP_FILE_NAME)) { Serial.println(F("Deleting tmp file")); if (!sd.remove(TMP_FILE_NAME)) { error("Can't remove tmp file"); } } // Create new file. Serial.println(F("Creating new file")); binFile.close(); if (!binFile.createContiguous(sd.vwd(), TMP_FILE_NAME, 512 * FILE_BLOCK_COUNT)) { error("createContiguous failed"); } // Get the address of the file on the SD. if (!binFile.contiguousRange(&bgnBlock, &endBlock)) { error("contiguousRange failed"); } // Use SdFat's internal buffer. uint8_t* cache = (uint8_t*)sd.vol()->cacheClear(); if (cache == 0) { error("cacheClear failed"); } // Flash erase all data in the file. Serial.println(F("Erasing all data")); uint32_t bgnErase = bgnBlock; uint32_t endErase; while (bgnErase < endBlock) { endErase = bgnErase + ERASE_SIZE; if (endErase > endBlock) { endErase = endBlock; } if (!sd.card()->erase(bgnErase, endErase)) { error("erase failed"); } bgnErase = endErase + 1; } // Start a multiple block write. if (!sd.card()->writeStart(bgnBlock, FILE_BLOCK_COUNT)) { error("writeBegin failed"); } // Initialize queues. emptyHead = emptyTail = 0; fullHead = fullTail = 0; // Use SdFat buffer for one block. emptyQueue[emptyHead] = (block_t*)cache; emptyHead = queueNext(emptyHead); // Put rest of buffers in the empty queue. for (uint8_t i = 0; i < BUFFER_BLOCK_COUNT; i++) { emptyQueue[emptyHead] = &block[i]; emptyHead = queueNext(emptyHead); } Serial.println(F("Logging - type any character to stop")); // Wait for Serial Idle. Serial.flush(); delay(10); uint32_t bn = 0; uint32_t t0 = millis(); uint32_t t1 = t0; uint32_t overrun = 0; uint32_t overrunTotal = 0; uint32_t count = 0; uint32_t maxLatency = 0; int32_t diff; // Start at a multiple of interval. uint32_t logTime = micros()/LOG_INTERVAL_USEC + 1; logTime *= LOG_INTERVAL_USEC; bool closeFile = false; digitalWrite(ERROR_LED_PIN,HIGH); while (1) { if (Serial1.available()) gps.encode(Serial1.read()); // Time for next data record. //logTime += LOG_INTERVAL_USEC; if (Serial.available() || (!digitalRead(BUTTON_PIN) && buttonPressTimer>100) ) { closeFile = true; buttonPressTimer = 0; } if (closeFile) { if (curBlock != 0 && curBlock->count >= 0) { // Put buffer in full queue. fullQueue[fullHead] = curBlock; fullHead = queueNext(fullHead); curBlock = 0; } } else { if (curBlock == 0 && emptyTail != emptyHead) { curBlock = emptyQueue[emptyTail]; emptyTail = queueNext(emptyTail); curBlock->count = 0; curBlock->overrun = overrun; overrun = 0; } // do { // diff = logTime - micros(); // } while(diff > 0); // if (diff < -10) { // error("LOG_INTERVAL_USEC too small"); // } if (curBlock == 0) { overrun++; } else { if (CANbus.read(rxmsg)) acquireCANData(&curBlock->data[curBlock->count++]); if (Serial1.available()) { char q = Serial1.read(); //Serial.print(q); gpsEncoded = gps.encode(q); } if (GPSsampleTimer >= 200){ GPSsampleTimer = 0; acquireGPSData(&curBlock->data[curBlock->count++]); } if (curBlock->count == DATA_DIM) { fullQueue[fullHead] = curBlock; fullHead = queueNext(fullHead); curBlock = 0; } } } if (fullHead == fullTail) { // Exit loop if done. if (closeFile) { break; } } else if (!sd.card()->isBusy()) { // Get address of block to write. block_t* pBlock = fullQueue[fullTail]; fullTail = queueNext(fullTail); // Write block to SD. uint32_t usec = micros(); if (!sd.card()->writeData((uint8_t*)pBlock)) { error("write data failed"); } usec = micros() - usec; t1 = millis(); if (usec > maxLatency) { maxLatency = usec; } count += pBlock->count; // Add overruns and possibly light LED. if (pBlock->overrun) { overrunTotal += pBlock->overrun; if (ERROR_LED_PIN >= 0) { digitalWrite(ERROR_LED_PIN, HIGH); } } // Move block to empty queue. emptyQueue[emptyHead] = pBlock; emptyHead = queueNext(emptyHead); bn++; if (bn == FILE_BLOCK_COUNT) { // File full so stop break; } } } if (!sd.card()->writeStop()) { error("writeStop failed"); } // Truncate file if recording stopped early. if (bn != FILE_BLOCK_COUNT) { Serial.println(F("Truncating file")); if (!binFile.truncate(512L * bn)) { error("Can't truncate file"); } } if (!binFile.rename(sd.vwd(), binName)) { error("Can't rename file"); } Serial.print(F("File renamed: ")); Serial.println(binName); Serial.print(F("Max block write usec: ")); Serial.println(maxLatency); Serial.print(F("Record time sec: ")); Serial.println(0.001*(t1 - t0), 3); Serial.print(F("Sample count: ")); Serial.println(count); Serial.print(F("Samples/sec: ")); Serial.println((1000.0)*count/(t1-t0)); Serial.print(F("Overruns: ")); Serial.println(overrunTotal); Serial.println(F("Done")); } //------------------------------------------------------------------------------ time_t getTeensy3Time() { return Teensy3Clock.get(); } void setup(void) { CANbus.begin(); rxmsg.timeout = 0; pinMode(6,OUTPUT); digitalWrite(6,HIGH); pinMode(BUTTON_PIN,INPUT_PULLUP); pinMode(ERROR_LED_PIN, OUTPUT); Serial.begin(9600); digitalWrite(ERROR_LED_PIN,HIGH); delay(1000); digitalWrite(ERROR_LED_PIN,LOW); setSyncProvider(getTeensy3Time); if (timeStatus()!= timeSet) { Serial.println("Unable to sync with the RTC"); } else { Serial.println("RTC has set the system time"); } Serial.print("Starting GPS... "); //tft.println("Starting GPS"); Serial1.begin(9600); delay(300); Serial1.println("$PMTK251,57600*2C"); //Set Baud Rate to 57600 delay(100); Serial1.flush(); Serial1.end(); Serial.println("Setting GPS to 57600 baud... "); Serial1.begin(57600); //delay(300); Serial1.println("$PMTK251,57600*2C"); //Set Baud Rate to 57600 Serial.println("Setting GPS to update at 5 Hz... "); Serial1.println("$PMTK220,200*2C"); //update at 5 Hz delay(100); Serial1.println("$PMTK300,200,0,0,0,0*2F"); //position fix update to 5 Hz for (int i = 0; i < 100; i++) { if (Serial1.available()) Serial.write(Serial1.read()); } Serial.println("\nDone."); char timeString[22]; time_t previousTime = now(); while (now() - previousTime < 1) resetMicros(); oneSecondReset.begin(resetMicros,1000000); sprintf(timeString,"%04d-%02d-%02d %02d:%02d:%02d.%06d",year(),month(),day(),hour(),minute(),second(),uint32_t(microsecondsPerSecond)); Serial.println(timeString); Serial.print(F("FreeRam: ")); Serial.println(FreeRam()); Serial.print(F("Records/block: ")); Serial.println(DATA_DIM); if (sizeof(block_t) != 512) { error("Invalid block size"); } // initialize file system. if (!sd.begin(SD_CS_PIN, SPI_FULL_SPEED)) { sd.initErrorPrint(); fatalBlink(); } // set date time callback function SdFile::dateTimeCallback(dateTime); // logData(); //uncomment to automatically start logging. Otherwise use the button } //------------------------------------------------------------------------------ void loop(void) { if (ERROR_LED_PIN >= 0) { digitalWrite(ERROR_LED_PIN, LOW); } // discard any input while (Serial.read() >= 0) {} Serial.println(); Serial.println(F("type:")); Serial.println(F("c - convert file to csv")); Serial.println(F("d - dump data to Serial")); Serial.println(F("e - overrun error details")); Serial.println(F("r - record data")); while(!Serial.available() && digitalRead(BUTTON_PIN) ) if (Serial1.available()) gps.encode(Serial1.read()); buttonPressTimer = 0; delay(50); //debounce char c; if (Serial.available()) c = tolower(Serial.read()); while (Serial.read() >= 0); if (!digitalRead(BUTTON_PIN)) c = 'r'; while (!digitalRead(BUTTON_PIN)){ if (buttonPressTimer > 2000){ c='c'; break; } } if (c == 'c') { analogWrite(ERROR_LED_PIN,64); binaryToCsv(); analogWrite(ERROR_LED_PIN,0); } else if (c == 'd') { dumpData(); } else if (c == 'e') { checkOverrun(); } else if (c == 'r') { logData(); } else if (!digitalRead(BUTTON_PIN)) { delay(500); if (!digitalRead(BUTTON_PIN)) logData(); } else { Serial.println(F("Invalid entry")); } digitalWrite(ERROR_LED_PIN, LOW); while (!digitalRead(BUTTON_PIN)){ if (Serial1.available()) gps.encode(Serial1.read()); if (ERROR_LED_PIN >= 0) { digitalWrite(ERROR_LED_PIN, LOW); } }//Wait to release the button; }
28.285166
180
0.589855
true
5,906
e41e9889da9fc68f958a3ee44e9d10dd53e24306
2,748
ino
Arduino
peggy2_corners_i2c/peggy2_corners_i2c.ino
KFW/peggy.pi.i2c
156d43ea14fd87e94c890cc67f4784bd6fa52b3b
[ "MIT" ]
null
null
null
peggy2_corners_i2c/peggy2_corners_i2c.ino
KFW/peggy.pi.i2c
156d43ea14fd87e94c890cc67f4784bd6fa52b3b
[ "MIT" ]
null
null
null
peggy2_corners_i2c/peggy2_corners_i2c.ino
KFW/peggy.pi.i2c
156d43ea14fd87e94c890cc67f4784bd6fa52b3b
[ "MIT" ]
0
null
null
/* Simple test of I2C communications * Peggy2 acts as receive only client * changes which corner is lit depending on signal from master * on Raspberry Pi */ #include <Peggy2.h> #include <Wire.h> Peggy2 frame1; // Make a first frame buffer object Peggy2 frame2; Peggy2 frame3; Peggy2 frame4; constant byte MYADDRESS = 42; // set I2C address volatile byte signal = 0; // volatile since used in interrupt volatile boolean signalFlag = false; byte pattern = 0; void setup() { frame0.HardwareInit(); // Only needed once, even if you've got lots of frames. Wire.begin(MYADDRESS); // join i2c bus Wire.onReceive(receiveEvent); // register event Serial.begin(9600); // start serial for output frame1.SetPoint(0,0); frame1.SetPoint(0,1); frame1.SetPoint(0,2); frame1.SetPoint(1,0); frame1.SetPoint(1,1); frame1.SetPoint(1,2); frame1.SetPoint(2,0); frame1.SetPoint(2,1); frame1.SetPoint(2,2); frame2.SetPoint(22,0); frame2.SetPoint(22,1); frame2.SetPoint(22,2); frame2.SetPoint(23,0); frame2.SetPoint(23,1); frame2.SetPoint(23,2); frame2.SetPoint(24,0); frame2.SetPoint(24,1); frame2.SetPoint(24,2); frame3.SetPoint(0,22); frame3.SetPoint(0,23); frame3.SetPoint(0,24); frame3.SetPoint(1,22); frame3.SetPoint(1,23); frame3.SetPoint(1,24); frame3.SetPoint(2,22); frame3.SetPoint(2,23); frame3.SetPoint(2,24); frame4.SetPoint(22,22); frame4.SetPoint(22,23); frame4.SetPoint(22,24); frame4.SetPoint(23,22); frame4.SetPoint(23,23); frame4.SetPoint(23,24); frame4.SetPoint(24,22); frame4.SetPoint(24,23); frame4.SetPoint(24,24); } // end setup void loop() { if (signalFlag){ noInterrupts(); signalFlag = false; pattern = signal; interrupts(); } // end if // signal will be between 0 and 15 (4 bits) // use pattern to determine which frame is shown // loop should be fast enough between signals to show pattern if (signal & 1){ // bit 1 is set (i.e. 0001b) frame1.RefreshAll(1); } if (signal & 2){ // bit 2 is set (i.e. 0010b) frame2.RefreshAll(1); } if (signal & 1){ // bit 3 is set (i.e. 0100b) frame3.RefreshAll(1); } if (signal & 1){ // bit 4 is set (i.e. 1000b) frame4.RefreshAll(1); } } // end loop void receiveEvent(int bytesReceived) { while (1 < Wire.available()) { // loop through all but the last in case more than 1 byte received byte b = Wire.read(); // do nothing with bytes } pattern = Wire.read(); // capture in volatile variable so it doesn't get messed with during interrupts signalFlag = true; // set flag for loop() } // end receiveEvent
26.423077
111
0.639374
true
878
254a75c4c7aa78730609b5768e3cfe9adbd479fb
2,853
ino
Arduino
examples/flytest/cmdMessenger.ino
BROWN1213/PSCS
1b4b3e9b381daa7799499c7600c24a138eabf543
[ "MIT" ]
8
2018-06-16T10:49:27.000Z
2018-07-14T10:21:13.000Z
examples/flytest/cmdMessenger.ino
BROWN1213/PSCS
1b4b3e9b381daa7799499c7600c24a138eabf543
[ "MIT" ]
1
2018-07-16T06:01:39.000Z
2019-01-23T02:58:32.000Z
examples/flytest/cmdMessenger.ino
BROWN1213/PSCS
1b4b3e9b381daa7799499c7600c24a138eabf543
[ "MIT" ]
2
2018-06-16T10:43:35.000Z
2018-06-16T11:40:45.000Z
enum { kAcknowledge, //0 kError, //1 kFalling, // 2 kHomePosition, //3 kFlyMode, //4 kManualControl, //5 }; void attachCommandCallbacks() { // Attach callback methods cmdMessenger.attach(OnUnknownCommand); cmdMessenger.attach(kFalling, OnFalling); cmdMessenger.attach(kHomePosition, OnHomePosition); cmdMessenger.attach(kFlyMode, OnFlyMode); cmdMessenger.attach(kManualControl, OnManualControl); } // Called when a received command has no attached function void OnUnknownCommand() { cmdMessenger.sendCmd(kError,F("Command without attached callback")); } // Callback function that sets falling void OnFalling() { // Read led state argument, interpret string as boolean int trigger; trigger = cmdMessenger.readInt16Arg(); if(trigger==1){ cmdMessenger.sendCmd(kAcknowledge,F("Hooking position")); tskFreeFall.hookingPosition(); } if(trigger==2){ cmdMessenger.sendCmd(kAcknowledge,F("free falling")); tskFreeFall.releasePosition(); } if(trigger==0){ cmdMessenger.sendCmd(kAcknowledge,F("ready position")); tskFreeFall.readyPosition(); } } void OnHomePosition(){ if(tskGps.getNumOfSatellites()>=6){ LocationInfo location=tskGps.getLocation(); GpsCoordinates gps_coord; gps_coord.lat=location.lat; gps_coord.lng=location.lng; gps_coord.alt=location.alt; tskLocation.setDestination(gps_coord); cmdMessenger.sendCmd(kAcknowledge,F("Home Position updated")); cansatBT.send(F("lat:lng:alt= ")); cansatBT.send(location.lat); cansatBT.sendln(location.lng); cansatBT.sendln(location.alt); }else{ cmdMessenger.sendCmd(kAcknowledge,F("Home Position Fail")); Serial.println(F("We need at least 6 satellites ")); } } void OnFlyMode(){ // Read led state argument, int trigger; trigger = cmdMessenger.readInt16Arg(); if(trigger==0){ //automode if(!tskNavigation.getNavigationMode()){ Serial.println(F("Navigation already automode ")); }else{ tskNavigation.setNavigationMode(0); } cmdMessenger.sendCmd(kAcknowledge,F("Navigation:auto")); } if(trigger==1){ //manual mode if(tskNavigation.getNavigationMode()){ Serial.println(F("Navigation already manualmode ")); }else{ tskNavigation.setNavigationMode(1); } cmdMessenger.sendCmd(kAcknowledge,F("Navigation:manual")); } } void OnManualControl(){ // Read led state argument, float trigger; if(!tskNavigation.getNavigationMode()){ cmdMessenger.sendCmd(kAcknowledge,F("Control fail..Set manualmode first!!!")); return; } trigger = cmdMessenger.readInt16Arg(); tskNavigation.winchControl((float)trigger*(float)89.); cmdMessenger.sendCmd(kAcknowledge,"manual Contol Ok"); Serial.print("Control angle="); Serial.println((float)trigger*(float)89.); }
25.702703
83
0.699614
true
723
389c323ba19e630ce5ea47143c6ba31b798832fa
34
ino
Arduino
arduino/samples/error_functionNameMissSpell/error_functionNameMissSpell.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
null
null
null
arduino/samples/error_functionNameMissSpell/error_functionNameMissSpell.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
null
null
null
arduino/samples/error_functionNameMissSpell/error_functionNameMissSpell.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
0
null
null
void setup() { } void Loop() { }
5.666667
14
0.5
true
11
7483b6bdd2e349bb176fd6724dc223fcde3c491f
2,355
ino
Arduino
libraries/arduinoWebSockets-master/examples/esp32/WebSocketClient/WebSocketClient.ino
OlegEfimov/arduino_prj
7706eb7279a55e3482e9fc1002110e86fa483b2e
[ "MIT" ]
null
null
null
libraries/arduinoWebSockets-master/examples/esp32/WebSocketClient/WebSocketClient.ino
OlegEfimov/arduino_prj
7706eb7279a55e3482e9fc1002110e86fa483b2e
[ "MIT" ]
null
null
null
libraries/arduinoWebSockets-master/examples/esp32/WebSocketClient/WebSocketClient.ino
OlegEfimov/arduino_prj
7706eb7279a55e3482e9fc1002110e86fa483b2e
[ "MIT" ]
1
2020-01-28T20:14:32.000Z
2020-01-28T20:14:32.000Z
/* * WebSocketClient.ino * * Created on: 24.05.2015 * */ #include <Arduino.h> #include <WiFi.h> #include <WiFiMulti.h> #include <WiFiClientSecure.h> #include <WebSocketsClient.h> WiFiMulti WiFiMulti; WebSocketsClient webSocket; HardwareSerial Serial1(2); #define USE_SERIAL Serial1 void hexdump(const void *mem, uint32_t len, uint8_t cols = 16) { const uint8_t* src = (const uint8_t*) mem; USE_SERIAL.printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", (ptrdiff_t)src, len, len); for(uint32_t i = 0; i < len; i++) { if(i % cols == 0) { USE_SERIAL.printf("\n[0x%08X] 0x%08X: ", (ptrdiff_t)src, i); } USE_SERIAL.printf("%02X ", *src); src++; } USE_SERIAL.printf("\n"); } void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) { switch(type) { case WStype_DISCONNECTED: USE_SERIAL.printf("[WSc] Disconnected!\n"); break; case WStype_CONNECTED: USE_SERIAL.printf("[WSc] Connected to url: %s\n", payload); // send message to server when Connected webSocket.sendTXT("Connected"); break; case WStype_TEXT: USE_SERIAL.printf("[WSc] get text: %s\n", payload); // send message to server // webSocket.sendTXT("message here"); break; case WStype_BIN: USE_SERIAL.printf("[WSc] get binary length: %u\n", length); hexdump(payload, length); // send data to server // webSocket.sendBIN(payload, length); break; } } void setup() { // USE_SERIAL.begin(921600); USE_SERIAL.begin(115200); //Serial.setDebugOutput(true); USE_SERIAL.setDebugOutput(true); USE_SERIAL.println(); USE_SERIAL.println(); USE_SERIAL.println(); for(uint8_t t = 4; t > 0; t--) { USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t); USE_SERIAL.flush(); delay(1000); } WiFiMulti.addAP("SSID", "passpasspass"); //WiFi.disconnect(); while(WiFiMulti.run() != WL_CONNECTED) { delay(100); } // server address, port and URL webSocket.begin("192.168.0.123", 81, "/"); // event handler webSocket.onEvent(webSocketEvent); // use HTTP Basic Authorization this is optional remove if not needed webSocket.setAuthorization("user", "Password"); // try ever 5000 again if connection has failed webSocket.setReconnectInterval(5000); } void loop() { webSocket.loop(); }
22.009346
92
0.645011
true
677
ff576145c10b4ece11a17cf67b5aee73d64b787e
2,174
ino
Arduino
examples/multi_control/multi_control.ino
m5stack/MODULE_GRBL13.2
fa64e57f3a38664fafe504959916395130178440
[ "MIT" ]
null
null
null
examples/multi_control/multi_control.ino
m5stack/MODULE_GRBL13.2
fa64e57f3a38664fafe504959916395130178440
[ "MIT" ]
null
null
null
examples/multi_control/multi_control.ino
m5stack/MODULE_GRBL13.2
fa64e57f3a38664fafe504959916395130178440
[ "MIT" ]
4
2021-08-13T23:35:18.000Z
2021-12-12T18:56:04.000Z
/* ******************************************************************************* * Copyright (c) 2021 by M5Stack * Equipped with M5Core sample source code * 配套 M5Core 示例源代码 * Visit the website for more information:https://docs.m5stack.com/en/module/grbl13.2 * 获取更多资料请访问:https://docs.m5stack.com/zh_CN/module/grbl13.2 * * describe: GRBL 13.2 Module. * date:2021/11/14 ******************************************************************************* GRBL 13.2 Module TEST Example,use I2C to control stepper motors(Stack two Module at the same time) 步进电机模块测试示例,使用I2C控制步进电机(同时堆叠两个模块) */ #include <M5Stack.h> #include "MODULE_GRBL13.2.h" /* * The I2C address of GRBL 13.2 Module is 0x70 by default. * GRBL 13.2 模块的 I2C 地址默认为 0x70。 * You could use the DIP Switch for modify I2C address to 0x71 * 您可以使用拨码开关将 I2C 地址修改为 0x71 */ #define STEPMOTOR_I2C_ADDR_1 0x70 #define STEPMOTOR_I2C_ADDR_2 0x71 GRBL _GRBL_A = GRBL(STEPMOTOR_I2C_ADDR_1); GRBL _GRBL_B = GRBL(STEPMOTOR_I2C_ADDR_2); void setup() { M5.begin(); M5.Power.begin(); Wire.begin(21, 22); _GRBL_A.Init(&Wire); _GRBL_B.Init(&Wire); Serial.begin(115200); m5.Lcd.setTextColor(WHITE, BLACK); m5.Lcd.setTextSize(3); m5.lcd.setBrightness(100); M5.Lcd.setCursor(80, 40); M5.Lcd.println("GRBL 13.2"); M5.Lcd.setCursor(50, 80); M5.Lcd.println("Press Btn A/B"); M5.Lcd.setCursor(50, 120); M5.Lcd.println("Control Motor"); _GRBL_A.setMode("absolute"); _GRBL_B.setMode("absolute"); } void loop() { // If Button A was pressed,stepmotor will rotate back and forth at a time // 如果按下按钮 A,步进电机将一次来回旋转 if (M5.BtnA.wasPressed()){ // A button Serial.print(_GRBL_A.readStatus()); _GRBL_A.setMotor(5,5,5,200); _GRBL_B.setMotor(5,5,5,200); _GRBL_A.setMotor(0,0,0,200); _GRBL_B.setMotor(0,0,0,200); } if (M5.BtnB.wasPressed()){ //USE Gcode _GRBL_A.sendGcode("G1 X5Y5Z5 F200"); _GRBL_B.sendGcode("G1 X5Y5Z5 F200"); _GRBL_A.sendGcode("G1 X0Y0Z0 F200"); _GRBL_B.sendGcode("G1 X0Y0Z0 F200"); } if (M5.BtnC.wasReleased()) { _GRBL_A.unLock(); _GRBL_B.unLock(); } M5.update(); }
28.605263
100
0.622815
true
789
6d2a785cb8f0fcb0df7e4dfb4f7d6bd8749ffcc3
1,082
ino
Arduino
arduino-board-mbed-os-v1.3.1/mbed/1.3.1/libraries/Portenta_Video/examples/Envie_video_coreboot/Envie_video_coreboot.ino
edgeimpulse/example-SparkFun-MicroMod-nRF52840
90cd687ed71778318b3157320ce6a4abdd92b467
[ "Apache-2.0" ]
15
2021-06-28T23:32:16.000Z
2022-03-31T17:46:54.000Z
arduino-board-mbed-os-v1.3.1/mbed/1.3.1/libraries/Portenta_Video/examples/Envie_video_coreboot/Envie_video_coreboot.ino
edgeimpulse/example-SparkFun-MicroMod-nRF52840
90cd687ed71778318b3157320ce6a4abdd92b467
[ "Apache-2.0" ]
null
null
null
arduino-board-mbed-os-v1.3.1/mbed/1.3.1/libraries/Portenta_Video/examples/Envie_video_coreboot/Envie_video_coreboot.ino
edgeimpulse/example-SparkFun-MicroMod-nRF52840
90cd687ed71778318b3157320ce6a4abdd92b467
[ "Apache-2.0" ]
7
2021-06-26T23:53:20.000Z
2021-11-16T09:36:28.000Z
#include "Portenta_Video.h" #include "image_320x240_argb8888.h" #include "SDRAM.h" #include "mbed.h" struct edid recognized_edid; mbed::DigitalOut video_on(PK_2); mbed::DigitalOut video_rst(PJ_3); void setup() { // put your setup code here, to run once: delay(1000); video_on = 1; delay(10); video_rst = 1; delay(10); int ret = -1; video_on = 0; delay(10); video_rst = 0; delay(100); while (ret < 0) { video_on = 0; delay(10); video_rst = 0; delay(100); video_on = 1; delay(100); video_rst = 1; ret = anx7625_init(0); } anx7625_dp_get_edid(0, &recognized_edid); anx7625_dp_start(0, &recognized_edid, EDID_MODE_640x480_60Hz); SDRAM.begin(getFramebufferEnd()); while (1) { stm32_LCD_DrawImage((void*)texture_raw, (void *)getNextFrameBuffer(), 300, 300, DMA2D_INPUT_RGB565); stm32_LCD_DrawImage((void*)texture_raw, (void *)getNextFrameBuffer(), 300, 300, DMA2D_INPUT_RGB565); } } int i = 0; void loop() { delay(1000); i = random(0, 0xFFFFFF); printf("now: %d\n", millis()); delay(1000); }
18.982456
104
0.654344
true
378
bbc34613d362302bc0e9c11d4bd1bf9f08346576
3,614
ino
Arduino
lib/ICM20948/examples/icm20948_TapDetection.ino
DemorianJH/SlimeVR-Tracker-ESP-ICM20948
d7377d930cb422e07eecf8bd0564347ac478ff01
[ "MIT" ]
10
2021-07-06T23:12:13.000Z
2022-02-17T16:39:22.000Z
lib/ICM20948/examples/icm20948_TapDetection.ino
DemorianJH/SlimeVR-Tracker-ESP-ICM20948
d7377d930cb422e07eecf8bd0564347ac478ff01
[ "MIT" ]
null
null
null
lib/ICM20948/examples/icm20948_TapDetection.ino
DemorianJH/SlimeVR-Tracker-ESP-ICM20948
d7377d930cb422e07eecf8bd0564347ac478ff01
[ "MIT" ]
1
2021-12-07T10:27:26.000Z
2021-12-07T10:27:26.000Z
// Modified lib originally from https://github.com/isouriadakis/Arduino_ICM20948_DMP_Full-Function // Uses a butterworth filter to detect an arbitrary number of taps from accel data // ICM20948 implementation is missing the tap feature - example shows how to process taps from accel. #include "Arduino-ICM20948.h" #include <Wire.h> #include "TapDetector.h" #define I2C_SDA 21 #define I2C_SCL 22 ArduinoICM20948 icm20948; ArduinoICM20948Settings icmSettings = { .i2c_speed = 400000, // i2c clock speed .i2c_address = 0x69, // i2c address .is_SPI = false, // Enable SPI, if disable use i2c .cs_pin = 10, // SPI chip select pin .spi_speed = 7000000, // SPI clock speed in Hz, max speed is 7MHz .mode = 1, // 0 = low power mode, 1 = high performance mode .enable_gyroscope = false, // Enables gyroscope output .enable_accelerometer = true, // Enables accelerometer output .enable_magnetometer = false, // Enables magnetometer output // Enables quaternion output .enable_gravity = false, // Enables gravity vector output .enable_linearAcceleration = false, // Enables linear acceleration output .enable_quaternion6 = false, // Enables quaternion 6DOF output .enable_quaternion9 = false, // Enables quaternion 9DOF output .enable_har = false, // Enables activity recognition .enable_steps = false, // Enables step counter .enable_step_detector = false, // Enables step detector .gyroscope_frequency = 1, // Max frequency = 225, min frequency = 1 .accelerometer_frequency = 200, // Max frequency = 225, min frequency = 1 .magnetometer_frequency = 1, // Max frequency = 70, min frequency = 1 .gravity_frequency = 1, // Max frequency = 225, min frequency = 1 .linearAcceleration_frequency = 1, // Max frequency = 225, min frequency = 1 .quaternion6_frequency = 150, // Max frequency = 225, min frequency = 50 .quaternion9_frequency = 150, // Max frequency = 225, min frequency = 50 .har_frequency = 50, // Max frequency = 225, min frequency = 50 .steps_frequency = 50, // Max frequency = 225, min frequency = 50 .step_detector_frequency = 50 }; TapDetector tapDetector; void tripple_tap_event() { Serial.println("TapTapTap!"); } void setup() { Serial.begin(115200); /* Values for TapDetector( int tap_count, // Number of sequential taps to listen for std::function<void()> tap_handler, // Callback used when [tap_count] number of taps is received (in timeframe) int prevent_event_ms = 25, // ms after an accelerometer event to prevent additional events for (debouncing) int event_repeat_ms = 400, // for multi-tap events, next tap must follow within this ms period float cutoff_threshold = 0.4f, // filtered value must be over this to register as a tap float cutoff_hz = 1.0f, // suppress accell data over this frequency float sampling_hz = 5.0f); // How fast to sample (should be at least double cutoff_hz) */ tapDetector = TapDetector(3, &tripple_tap_event); // Tripple tap Wire.begin(I2C_SDA, I2C_SCL); Wire.setClock(icmSettings.i2c_speed); icm20948.init(icmSettings); } void loop() { icm20948.task(); float x, y, z; if (icm20948.accelDataIsReady()) { icm20948.readAccelData(&x, &y, &z); tapDetector.update(z); } delay(1); }
43.02381
120
0.649696
true
951
9e31c638788fc11e0e4ebeca51f38602734971e5
3,095
ino
Arduino
experiment_4_dabble_phone_sensors/experiment_4_dabble_phone_sensors.ino
ghallberg-nbtt/congenial-robot
8b133276314ea3e73c1897d9358b1f602ecc3251
[ "MIT" ]
null
null
null
experiment_4_dabble_phone_sensors/experiment_4_dabble_phone_sensors.ino
ghallberg-nbtt/congenial-robot
8b133276314ea3e73c1897d9358b1f602ecc3251
[ "MIT" ]
null
null
null
experiment_4_dabble_phone_sensors/experiment_4_dabble_phone_sensors.ino
ghallberg-nbtt/congenial-robot
8b133276314ea3e73c1897d9358b1f602ecc3251
[ "MIT" ]
0
null
null
/* Accelerometer block of Phone sensor module allows you to access your smartphone's accelerometer values. You can reduce the size of library compiled by enabling only those modules that you wan to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename. Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/ */ /* Additions by Gary Hallberg Dabble Phone Sensor Licensed under MIT https://github.com/ghallberg-nbtt/congenial-robot/blob/main/LICENSE */ #define CUSTOM_SETTINGS #define INCLUDE_SENSOR_MODULE #include <DabbleESP32.h> const int FREQ = 5000; const int RED_LED_CHANNEL = 0; const int GREEN_LED_CHANNEL = 1; const int BLUE_LED_CHANNEL = 2; const int RESOLUTION = 8; const int RED_LED = 27; //GPIO27 for red LED const int GREEN_LED = 32; //GPIO32 for green LED const int BLUE_LED = 33; //GPIO33 for blue LED void setup() { Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate. Dabble.begin("MyEsp32"); //set bluetooth name of your device // configure LED PWM functionalitites ledcSetup(RED_LED_CHANNEL, FREQ, RESOLUTION); ledcSetup(GREEN_LED_CHANNEL, FREQ, RESOLUTION); ledcSetup(BLUE_LED_CHANNEL, FREQ, RESOLUTION); // attach the channel to the GPIO to be controlled ledcAttachPin(RED_LED, RED_LED_CHANNEL); ledcAttachPin(GREEN_LED, GREEN_LED_CHANNEL); ledcAttachPin(BLUE_LED, BLUE_LED_CHANNEL); //turn off all LEDS ledcWrite(RED_LED, 0); ledcWrite(GREEN_LED, 0); ledcWrite(BLUE_LED, 0); } void loop() { Dabble.processInput(); print_Accelerometer_data(); float valRed = Sensor.getAccelerometerXaxis(); // X axis will trigger red LED float valGreen = Sensor.getAccelerometerYaxis(); // Y axis will trigger green LED float valBlue = Sensor.getAccelerometerZaxis(); // Z axis will trigger blue LED int valRed_int = (int) valRed; //convert to integer int valGreen_int = (int) valGreen; //convert to integer int valBlue_int = (int) valBlue; //convert to integer valRed_int = map(valRed_int, -5, 5, 0, 255); //convert to PWM value valGreen_int = map(valGreen_int, -5, 5, 0, 255); //convert to PWM value valBlue_int = map(valBlue_int, -5, 5, 0, 255); //convert to PWM value valRed_int = constrain (valRed_int, 0, 255); //constrain PWM range valGreen_int = constrain (valGreen_int, 0, 255); //constrain PWM range valBlue_int - constrain (valBlue_int, 0, 255); //constrain PWM range ledcWrite(RED_LED_CHANNEL, valRed_int); //write value to LED ledcWrite(GREEN_LED_CHANNEL, valGreen_int); //write value to LED ledcWrite(BLUE_LED, valBlue_int); //write value to LED delay (15); } void print_Accelerometer_data() { Serial.print("X_axis: "); Serial.print(Sensor.getAccelerometerXaxis(), 4); Serial.print('\t'); Serial.print("Y_axis: "); Serial.print(Sensor.getAccelerometerYaxis(), 4); Serial.print('\t'); Serial.print("Z_axis: "); Serial.println(Sensor.getAccelerometerZaxis(), 4); Serial.println(); }
34.775281
107
0.71567
true
857
a6ca087a9f82318c46816121178c3b5fd1c4b5af
6,767
ino
Arduino
Stupid video clock/libraries/TVout/PongNTSC/PongNTSC.ino
andydoswell/stupid-video-clock
3cb36ae7d704f2b90d0743518dea1af2594e4861
[ "MIT" ]
null
null
null
Stupid video clock/libraries/TVout/PongNTSC/PongNTSC.ino
andydoswell/stupid-video-clock
3cb36ae7d704f2b90d0743518dea1af2594e4861
[ "MIT" ]
null
null
null
Stupid video clock/libraries/TVout/PongNTSC/PongNTSC.ino
andydoswell/stupid-video-clock
3cb36ae7d704f2b90d0743518dea1af2594e4861
[ "MIT" ]
0
null
null
/******** * Arduino Pong * By Pete Lamonica * modified by duboisvb * updated by James Bruce (http://www.makeuseof.com/tag/author/jbruce * A simple implementation of Pong on the Arduino using a TV for output. * */ #include <TVout.h> #include <fontALL.h> #define WHEEL_ONE_PIN 0 //analog #define WHEEL_TWO_PIN 1 //analog #define BUTTON_ONE_PIN 2 //digital to start game // #define BUTTON_TWO_PIN 3 //digital to reset and go back to main menu #define PADDLE_HEIGHT 14 #define PADDLE_WIDTH 1 #define RIGHT_PADDLE_X (TV.hres()-4) #define LEFT_PADDLE_X 2 #define IN_GAMEA 0 //in game state - draw constants of the game box #define IN_GAMEB 0 //in game state - draw the dynamic part of the game #define IN_MENU 1 //in menu state #define GAME_OVER 2 //game over state #define LEFT_SCORE_X (TV.hres()/2-15) #define RIGHT_SCORE_X (TV.hres()/2+10) #define SCORE_Y 4 #define MAX_Y_VELOCITY 6 #define PLAY_TO 7 #define LEFT 0 #define RIGHT 1 TVout TV; unsigned char x,y; boolean button1Status = false; // boolean button2Status = false; int wheelOnePosition = 0; int wheelTwoPosition = 0; int rightPaddleY = 0; int leftPaddleY = 0; unsigned char ballX = 0; unsigned char ballY = 0; char ballVolX = 2; char ballVolY = 2; int leftPlayerScore = 0; int rightPlayerScore = 0; int frame = 0; int state = IN_MENU; void processInputs() { wheelOnePosition = analogRead(WHEEL_ONE_PIN); // delay(50); wheelTwoPosition = analogRead(WHEEL_TWO_PIN); // delay(50); button1Status = (digitalRead(BUTTON_ONE_PIN)); // button2Status = (digitalRead(BUTTON_TWO_PIN) == LOW); if ((button1Status == 0)&& (state == GAME_OVER)) { Serial.println("game over, drawing menu"); drawMenu (); } delay(50); //Serial.println(button1Status); //Serial.println(state); //Serial.println(button2Status); //Serial.println(wheelOnePosition); //Serial.println(wheelTwoPosition); } void drawGameScreen() { // TV.clear_screen(); //draw right paddle rightPaddleY = ((wheelOnePosition /8) * (TV.vres()-PADDLE_HEIGHT))/ 128; x = RIGHT_PADDLE_X; for(int i=0; i<PADDLE_WIDTH; i++) { TV.draw_line(x+i,rightPaddleY,x+i,rightPaddleY+PADDLE_HEIGHT,1); } //draw left paddle leftPaddleY = ((wheelTwoPosition /8) * (TV.vres()-PADDLE_HEIGHT))/ 128; x = LEFT_PADDLE_X; for(int i=0; i<PADDLE_WIDTH; i++) { TV.draw_line(x+i,leftPaddleY,x+i,leftPaddleY+PADDLE_HEIGHT,1); } //draw score TV.print_char(LEFT_SCORE_X,SCORE_Y,'0'+leftPlayerScore); TV.print_char(RIGHT_SCORE_X,SCORE_Y,'0'+rightPlayerScore); //draw ball TV.set_pixel(ballX, ballY, 2); } //player == LEFT or RIGHT void playerScored(byte player) { if(player == LEFT) leftPlayerScore++; if(player == RIGHT) rightPlayerScore++; //check for win if(leftPlayerScore == PLAY_TO || rightPlayerScore == PLAY_TO) { state = GAME_OVER; } ballVolX = -ballVolX; } void drawBox() { TV.clear_screen(); //draw net for(int i=1; i<TV.vres() - 4; i+=6) { TV.draw_line(TV.hres()/2,i,TV.hres()/2,i+3,1); } // had to make box a bit smaller to fit tv TV.draw_line(0, 0, 0,95,1 ); // left TV.draw_line(0, 0, 126,0,1 ); // top TV.draw_line(126, 0, 126,95,1 ); // right TV.draw_line(0, 95, 126,95,1 ); // bottom state = IN_GAMEB; } void drawMenu() { x = 0; y = 0; char volX =3; char volY = 3; TV.clear_screen(); TV.select_font(font8x8); TV.print(10, 5, "Arduino Pong"); TV.select_font(font4x6); TV.print(22, 35, "Press Button"); TV.print(30, 45, "To Start"); delay(1000); while(!button1Status) { Serial.println("menu"); Serial.println(button1Status); processInputs(); TV.delay_frame(3); if(x + volX < 1 || x + volX > TV.hres() - 1) volX = -volX; if(y + volY < 1 || y + volY > TV.vres() - 1) volY = -volY; if(TV.get_pixel(x + volX, y + volY)) { TV.set_pixel(x + volX, y + volY, 0); if(TV.get_pixel(x + volX, y - volY) == 0) { volY = -volY; } else if(TV.get_pixel(x - volX, y + volY) == 0) { volX = -volX; } else { volX = -volX; volY = -volY; } } TV.set_pixel(x, y, 0); x += volX; y += volY; TV.set_pixel(x, y, 1); } TV.select_font(font4x6); state = IN_GAMEA; } void setup() { //Serial.begin(9600); x=0; y=0; TV.begin(_NTSC); //for devices with only 1k sram(m168) use TV.begin(_NTSC,128,56) ballX = TV.hres() / 2; ballY = TV.vres() / 2; // pinMode(BUTTON_ONE_PIN, INPUT); // sets the digital pin as output } void loop() { processInputs(); if(state == IN_MENU) { drawMenu(); } if(state == IN_GAMEA) { //Serial.println("gamA"); //Serial.println(button1Status); drawBox(); } if(state == IN_GAMEB) { if(frame % 3 == 0) { //every third frame ballX += ballVolX; ballY += ballVolY; // change if hit top or bottom if(ballY <= 1 || ballY >= TV.vres()-1) { ballVolY = -ballVolY; delay(100); TV.tone( 2000,30 ); } // test left side for wall hit if(ballVolX < 0 && ballX == LEFT_PADDLE_X+PADDLE_WIDTH-1 && ballY >= leftPaddleY && ballY <= leftPaddleY + PADDLE_HEIGHT) { ballVolX = -ballVolX; ballVolY += 2 * ((ballY - leftPaddleY) - (PADDLE_HEIGHT / 2)) / (PADDLE_HEIGHT / 2); delay(100); TV.tone(2000,30 ); } // test right side for wall hit if(ballVolX > 0 && ballX == RIGHT_PADDLE_X && ballY >= rightPaddleY && ballY <= rightPaddleY + PADDLE_HEIGHT) { ballVolX = -ballVolX; ballVolY += 2 * ((ballY - rightPaddleY) - (PADDLE_HEIGHT / 2)) / (PADDLE_HEIGHT / 2); delay(100); TV.tone( 2000,30 ); } //limit vertical speed if(ballVolY > MAX_Y_VELOCITY) ballVolY = MAX_Y_VELOCITY; if(ballVolY < -MAX_Y_VELOCITY) ballVolY = -MAX_Y_VELOCITY; // Scoring if(ballX <= 1) { playerScored(RIGHT); // sound delay(100); TV.tone( 500,300 ); } if(ballX >= TV.hres() - 1) { playerScored(LEFT); // sound delay(100); TV.tone( 500,300 ); } } // if(button1Status) Serial.println((int)ballVolX); drawGameScreen(); } if(state == GAME_OVER) { drawGameScreen(); TV.select_font(font8x8); TV.print(29,25,"GAME"); TV.print(68,25,"OVER"); while(!button1Status) { processInputs(); delay(50); } TV.select_font(font4x6); //reset the font //reset the scores leftPlayerScore = 0; rightPlayerScore = 0; state = IN_MENU; } TV.delay_frame(1); if(++frame == 60) frame = 0; //increment and/or reset frame counter }
22.708054
129
0.603813
true
2,214
7b9cfe715550b0be45f7ba1424d9c8306d9ae326
632
ino
Arduino
src/Practica13_LCD_prueba/Practica13_LCD_prueba.ino
alexxwe/arduino
294bd83ab3dc851ed9c02a9efa1c71cfaad5fb7f
[ "MIT" ]
null
null
null
src/Practica13_LCD_prueba/Practica13_LCD_prueba.ino
alexxwe/arduino
294bd83ab3dc851ed9c02a9efa1c71cfaad5fb7f
[ "MIT" ]
null
null
null
src/Practica13_LCD_prueba/Practica13_LCD_prueba.ino
alexxwe/arduino
294bd83ab3dc851ed9c02a9efa1c71cfaad5fb7f
[ "MIT" ]
0
null
null
#include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> #define I2C_ADDR 0x27 //ese 0x significa que es hexadecimal, no decimal LiquidCrystal_I2C lcd(I2C_ADDR,2,1,0,4,5,6,7); void setup() { lcd.begin(16,2); //inicializamos el display, 16 caracteres en 2 lineas lcd.setBacklightPin(3,POSITIVE); //encender luz lcd.setBacklight(HIGH); //posicion del texto lcd.home(); lcd.setCursor(4,0); lcd.print("Alex Paz"); //texto que va a escribirse en la pantalla lcd.setCursor(0,1); //donde queremos que empiece a escribir, "(linea 1, posicion 0)" lcd.print("Estas buenisimo"); } void loop() { }
21.793103
87
0.689873
true
211
8f370e5939b41a7450d87444f090c3253f7674e0
1,020
ino
Arduino
BagBot/Libraries/jrowberg-i2cdevlib-3cc80d8/jrowberg-i2cdevlib-3cc80d8/Arduino/MS5803/examples/test_MS5803/test_MS5803.ino
rmcguirect/BagBot
30781268f22b43a2e784525527b3dc44e049f7e9
[ "MIT" ]
7
2020-03-11T04:54:20.000Z
2022-02-02T20:42:49.000Z
Libraries/i2cdevlib-master/Arduino/MS5803/examples/test_MS5803/test_MS5803.ino
Sameep2808/Robocon-Pick-Up-and-Throw-Robot
8944c7fb53a17678c96d34486762972b6f8722cc
[ "MIT" ]
null
null
null
Libraries/i2cdevlib-master/Arduino/MS5803/examples/test_MS5803/test_MS5803.ino
Sameep2808/Robocon-Pick-Up-and-Throw-Robot
8944c7fb53a17678c96d34486762972b6f8722cc
[ "MIT" ]
1
2021-06-17T16:28:48.000Z
2021-06-17T16:28:48.000Z
#include <Wire.h> #include <I2Cdev.h> #include <MS5803_I2C.h> //const uint8_t MS_MODEL = 1; // MS5803-01BA //const uint8_t MS_MODEL = 2; // MS5803-02BA const uint8_t MS_MODEL = 5; // MS5803-05BA //const uint8_t MS_MODEL = 14; // MS5803-14BA //const uint8_t MS_MODEL = 30; // MS5803-30BA MS5803 presstemp(0x76); const uint8_t loop_delay = 10; // Seconds between readings uint32_t wake_time = millis(); void setup() { Serial.begin(57600); Wire.begin(); // Start up and get Calibration constants. presstemp.initialize(MS_MODEL); if ( presstemp.testConnection() ) Serial.println("We are communicating with MS5803 via I2C."); else Serial.println("I2C Communications with MS5803 failed."); } void loop(){ Serial.print("Getting temperature"); presstemp.calcMeasurements(ADC_4096); Serial.print("The temperature is "); Serial.print(presstemp.getTemp_C()); Serial.println(" C"); Serial.print("The pressure is "); Serial.print(presstemp.getPress_mBar()); Serial.println(" mBar"); delay(2000); }
31.875
103
0.713725
true
305
6b11b98bc18a8a11917e8a0934da8e787e863b34
1,023
ino
Arduino
Analysis/Test/Test.ino
YuryBrodskiy/msp430_delta_robot
c33ed1bc047ebf4981947506b49517c166a9edc7
[ "MIT" ]
1
2015-07-24T20:08:34.000Z
2015-07-24T20:08:34.000Z
Analysis/Test/Test.ino
YuryBrodskiy/msp430_delta_robot
c33ed1bc047ebf4981947506b49517c166a9edc7
[ "MIT" ]
null
null
null
Analysis/Test/Test.ino
YuryBrodskiy/msp430_delta_robot
c33ed1bc047ebf4981947506b49517c166a9edc7
[ "MIT" ]
0
null
null
/* Sweep by BARRAGAN <http://barraganstudio.com> This example code is in the public domain. modified 8 Nov 2013 by Scott Fitzgerald http://www.arduino.cc/en/Tutorial/Sweep */ #include <Servo.h> Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards int numpos = 4; int usecpos[4] = {1400, 1500, 1405, 1500}; //int numpos = 2; //int usecpos[2] = {1492, 1500}; int lastpos = usecpos[0]; int stept = 1; int waitt = 500; void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { for (int p = 0; p < numpos; p++) { if (lastpos < usecpos[p]) { for (int us = lastpos; us < usecpos[p]; us++) { myservo.writeMicroseconds(us); delay(stept); } } else { for (int us = lastpos; us > usecpos[p]; us--) { myservo.writeMicroseconds(us); delay(stept); } } lastpos = usecpos[p]; delay(waitt); } }
18.944444
73
0.580645
true
331
ffb6fe68affb89bd245791e213fca80e232234b8
9,820
ino
Arduino
cloudbrigade-deepblaster-controller.ino
CloudBrigade/cloudbrigade-deepblaster-controller
6396242f21649b63bd55f0a0a168dc142ebc9d7f
[ "Apache-2.0" ]
null
null
null
cloudbrigade-deepblaster-controller.ino
CloudBrigade/cloudbrigade-deepblaster-controller
6396242f21649b63bd55f0a0a168dc142ebc9d7f
[ "Apache-2.0" ]
null
null
null
cloudbrigade-deepblaster-controller.ino
CloudBrigade/cloudbrigade-deepblaster-controller
6396242f21649b63bd55f0a0a168dc142ebc9d7f
[ "Apache-2.0" ]
0
null
null
/* * * * * * * * * * * * * * * * * * * * * * * * Cloud Brigade - Deep Blaster * Code by: Chris Miller * Website: https://www.cloudbrigade.com * Version: 1.0 * Date: Apr 21, 2021 * Copyright (C) 2020, Apache 2.0 License * * Code included from these excellent projects * Servo Trajectory by Simon Bluett * https://github.com/chillibasket/arduino-classes/tree/master/servo-trajectory * Robust Serial by Antonin Raffin * https://github.com/araffin/arduino-robust-serial * * * * * * * * * * * * * * * * * * * * * * */ #include <Arduino.h> #include "trajectory.h" #include "order.h" #include "blasterctrl.h" #include "parameters.h" #include <Servo.h> bool is_connected = false; ///< True if the connection with the DeepRacer is available /** * If you want the acceleration and deceleration to be the same * FORMAT: Trajectory(max velocity, acceleration) * If the acceleration and deceleration are different * FORMAT: Trajectory(max velocity, acceleration, deceleration) * * By default the dynamics controller turns off when it is within 0.1 units * of the target position. This threshold value can be changed in the declaration * FORMAT: Dynamics(max velocity, acceleration, deceleration, threshold) */ // --- Instantiate the class --- Trajectory xservoTrajectory(60, 40, 34, 0.1); Trajectory yservoTrajectory(60, 40, 34, 0.1); Servo xservo; Servo yservo; // --- Define global variables --- // The controller will be updated at a rate of 100Hz #define UPDATE_FREQUENCY 100 #define UPDATE_TIME (1000 / UPDATE_FREQUENCY) unsigned long updateTimer = 0; int xservo_angle = (X_INITIAL_THETA + X_OFFSET); int yservo_angle = (Y_INITIAL_THETA + Y_OFFSET); int flywheel_engage = 0; int trigger_engage = 0; int fspin; /* * * * * * * * * * * * * * * * * * * * * * * * SETUP * * * * * * * * * * * * * * * * * * * * * * */ void setup() { // Init Serial Serial.begin(SERIAL_BAUD); // Serial.println("Starting DeepBlaster Serial Controller"); // Init Motors and Servos pinMode(FLYWHEEL_PIN, OUTPUT); pinMode(TRIGGER_PIN, OUTPUT); // Attaches the servo pin to the servo object xservo.attach(XSERVO_PIN); yservo.attach(YSERVO_PIN); // Set servos at initial position xservo.write(X_INITIAL_THETA + X_OFFSET); yservo.write(Y_INITIAL_THETA + X_OFFSET); // By default the controller starts at 0, so we need to // set the starting angle as well xservoTrajectory.reset(X_INITIAL_THETA + X_OFFSET); yservoTrajectory.reset(Y_INITIAL_THETA + Y_OFFSET); /** * FORMAT: Trajectory(float maxVelocity, float acceleration, float deceleration, float threshold) * @param Maximum Velocity (units/second) - default = 100 * @param Acceleration (units/second^2) - default = 50 * @param Deceleration (units/second^2) - default = same as acceleration * @param Threshold (units) - default = 0.1 // For example: Trajectory servoTrajectory(20, 15, 12.5, 0.01); // If the default threshold of 0.1 doesn't need to be changed: Trajectory servoTrajectory(20, 15, 12.5); // If you want the acceleration and deceleration to be the same: Trajectory servoTrajectory(20, 15); * If we suddenly decide we want to change the maximum velocity to 30°/s, * the acceleration to 15°/s^2 and deceleration to 5.3°/s^2 //xservoTrajectory.setMaxVel(30); //xservoTrajectory.setAcc(15); //xservoTrajectory.setDec(5.3); * To read what the current velocity and acceleration settings are //float maxVelocity = xservoTrajectory.getMaxVel(); //float acceleration = xservoTrajectory.getAcc(); //float deceleration = xservoTrajectory.getDec(); */ } /* * * * * * * * * * * * * * * * * * * * * * * * LOOP * * * * * * * * * * * * * * * * * * * * * * */ void loop() { // Update the servo position at regular intervals if (millis() - updateTimer >= UPDATE_TIME) { updateTimer += UPDATE_TIME; // Update the controller float xcurrentAngle = xservoTrajectory.update(); float ycurrentAngle = yservoTrajectory.update(); // Set the new servo position; the function only takes integer numbers xservo.write(round(xcurrentAngle)); yservo.write(round(ycurrentAngle)); /** * For more precise servo control, you could use writeMicroseconds. * The min and max PWM pulse widths which correspond to the 0° and 180° * positions needs to be inserted for MIN_PWM and MAX_PWM. */ //xservo.writeMicroseconds(map(currentAngle, 0, 180, MIN_PWM, MAX_PWM)); // Output the target position, along with the current position and velocity // Serial.print("Target: "); // Serial.print(xservoTrajectory.getTarget()); // Serial.print(", Angle: "); // Serial.print(xservoTrajectory.getPos()); // Serial.print(", Velocity: "); // Serial.println(xservoTrajectory.getVel()); // Preprogrammed movemnets to demo/test the blaster controller // Only once the servo has reached the desired position, complete the next move if (xservoTrajectory.ready()) { xservoTrajectory.setTargetPos(xservo_angle + X_OFFSET); } if (yservoTrajectory.ready()) { yservoTrajectory.setTargetPos(yservo_angle + Y_OFFSET); } if (flywheel_engage == 1){ spinup(); fspin = 1; } if (trigger_engage == 1){ fire(); } // if ((fspin = 1) && (flywheel_engage = 0)){ // spindown(); // } } get_messages_from_serial(); } void spinup(){ digitalWrite(FLYWHEEL_PIN, HIGH); //Serial.println("Flywheels Engaged"); delay(FLYWHEEL_SPINUP_TIME); } void spindown(){ digitalWrite(FLYWHEEL_PIN, LOW); //Serial.println("Flywheels Disengaged"); } void fire() { digitalWrite(TRIGGER_PIN, HIGH); //Serial.println("Fire!!!"); delay(80); digitalWrite(TRIGGER_PIN, LOW); spindown(); } void stop() { digitalWrite(TRIGGER_PIN, LOW); digitalWrite(FLYWHEEL_PIN, LOW); } int convert_to_pwm(float motor_speed) { // TODO: compensate the non-linear dependency speed = f(PWM_Value) return (int) round(abs(motor_speed)*(255./100.)); } void get_messages_from_serial() { if(Serial.available() > 0) { // The first byte received is the instruction Order order_received = read_order(); if(order_received == HELLO) { // If the cards haven't say hello, check the connection if(!is_connected) { is_connected = true; write_order(HELLO); } else { // If we are already connected do not send "hello" to avoid infinite loop write_order(ALREADY_CONNECTED); } } else if(order_received == ALREADY_CONNECTED) { is_connected = true; } else { switch(order_received) { case STOP: { trigger_engage = 0; flywheel_engage = 0; xservo_angle = (X_INITIAL_THETA + X_OFFSET); yservo_angle = (Y_INITIAL_THETA + Y_OFFSET); stop(); if(DEBUG) { //write_order(STOP); } break; } case XSERVO: { xservo_angle = read_i16(); if(DEBUG) { write_order(XSERVO); //write_i16(servo_angle); } break; } case YSERVO: { yservo_angle = read_i16(); if(DEBUG) { write_order(YSERVO); //write_i16(servo_angle); } break; } case FLYWHEEL: { // 0 or 1 flywheel_engage = read_i8(); if(DEBUG) { write_order(FLYWHEEL); write_i8(flywheel_engage); } break; } case TRIGGER: { // 0 or 1 trigger_engage = read_i8(); if(DEBUG) { write_order(TRIGGER); write_i8(trigger_engage); } break; } // Unknown order default: write_order(ERROR); //write_i16(404); return; } } write_order(RECEIVED); // Confirm the reception } } Order read_order() { return (Order) Serial.read(); } void wait_for_bytes(int num_bytes, unsigned long timeout) { unsigned long startTime = millis(); //Wait for incoming bytes or exit if timeout while ((Serial.available() < num_bytes) && (millis() - startTime < timeout)){} } // NOTE : Serial.readBytes is SLOW // this one is much faster, but has no timeout void read_signed_bytes(int8_t* buffer, size_t n) { size_t i = 0; int c; while (i < n) { c = Serial.read(); if (c < 0) break; *buffer++ = (int8_t) c; // buffer[i] = (int8_t)c; i++; } } int8_t read_i8() { wait_for_bytes(1, 100); // Wait for 1 byte with a timeout of 100 ms return (int8_t) Serial.read(); } int16_t read_i16() { int8_t buffer[2]; wait_for_bytes(2, 100); // Wait for 2 bytes with a timeout of 100 ms read_signed_bytes(buffer, 2); return (((int16_t) buffer[0]) & 0xff) | (((int16_t) buffer[1]) << 8 & 0xff00); } int32_t read_i32() { int8_t buffer[4]; wait_for_bytes(4, 200); // Wait for 4 bytes with a timeout of 200 ms read_signed_bytes(buffer, 4); return (((int32_t) buffer[0]) & 0xff) | (((int32_t) buffer[1]) << 8 & 0xff00) | (((int32_t) buffer[2]) << 16 & 0xff0000) | (((int32_t) buffer[3]) << 24 & 0xff000000); } void write_order(enum Order myOrder) { uint8_t* Order = (uint8_t*) &myOrder; Serial.write(Order, sizeof(uint8_t)); } void write_i8(int8_t num) { Serial.write(num); } void write_i16(int16_t num) { int8_t buffer[2] = {(int8_t) (num & 0xff), (int8_t) (num >> 8)}; Serial.write((uint8_t*)&buffer, 2*sizeof(int8_t)); } void write_i32(int32_t num) { int8_t buffer[4] = {(int8_t) (num & 0xff), (int8_t) (num >> 8 & 0xff), (int8_t) (num >> 16 & 0xff), (int8_t) (num >> 24 & 0xff)}; Serial.write((uint8_t*)&buffer, 4*sizeof(int8_t)); }
28.797654
168
0.624949
true
2,789
a4930506ec9a72a01ff27fc8c7d8933c19642245
2,258
ino
Arduino
examples/DefaultBoard/DefaultBoard.ino
Airan-Lab/OpenBCI_32bit_Library
f5395ee46551b4ade88c604cbbd7ab39041ce622
[ "MIT" ]
2
2017-01-19T04:59:28.000Z
2017-10-03T19:25:25.000Z
examples/DefaultBoard/DefaultBoard.ino
Airan-Lab/OpenBCI_32bit_Library_Wired
f5395ee46551b4ade88c604cbbd7ab39041ce622
[ "MIT" ]
null
null
null
examples/DefaultBoard/DefaultBoard.ino
Airan-Lab/OpenBCI_32bit_Library_Wired
f5395ee46551b4ade88c604cbbd7ab39041ce622
[ "MIT" ]
0
null
null
#include <DSPI.h> #include <OBCI32_SD.h> #include <EEPROM.h> #include <OpenBCI_32bit_Library.h> #include <OpenBCI_32bit_Library_Definitions.h> // Booleans Required for SD_Card_Stuff.ino boolean addAccelToSD = false; // On writeDataToSDcard() call adds Accel data to SD card write boolean addAuxToSD = false; // On writeDataToSDCard() call adds Aux data to SD card write boolean SDfileOpen = false; // Set true by SD_Card_Stuff.ino on successful file open void setup() { // Bring up the OpenBCI Board /* Possible Rates: * 250 Hz: ADS_RATE_250Hz * 500 Hz: ADS_RATE_500Hz * 1 kHz: ADS_RATE_1kHz * 2 kHz: ADS_RATE_2kHz * 4 kHz: ADS_RATE_4kHz * 8 kHz: ADS_RATE_8kHz * 16 kHz: ADS_RATE_16kHz */ board.beginDebug(ADS_RATE_500Hz); // Notify the board we want to use accel data board.useAccel = true; } void loop() { if (board.streaming) { if (board.channelDataAvailable) { // Read from the ADS(s), store data, set channelDataAvailable flag to false board.updateChannelData(); // Check to see if accel has new data if(board.accelHasNewData()) { // Get new accel data board.accelUpdateAxisData(); // Tell the SD_Card_Stuff.ino to add accel data in the next write to SD addAccelToSD = true; // Set false after writeDataToSDcard() } // Verify the SD file is open if(SDfileOpen) { // Write to the SD card, writes aux data writeDataToSDcard(board.sampleCounter); } if (board.timeSynced) { // Send time synced packet with channel data, current board time, and an accel reading // X axis is sent on sampleCounter % 10 == 7 // Y axis is sent on sampleCounter % 10 == 8 // Z axis is sent on sampleCounter % 10 == 9 board.sendChannelDataWithTimeAndAccel(); } else { // Send standard packet with channel data board.sendChannelDataWithAccel(); } } } // Check serial 1 for new data if (board.hasDataSerial1()) { // Read one char from the serial 1 port char newChar = board.getCharSerial1(); // Send to the sd library for processing sdProcessChar(newChar); // Send to the board library board.processChar(newChar); } }
30.931507
94
0.661647
true
638
b406c45785bf940a3f9cfcbff7c95ef7d833bf16
699
ino
Arduino
08-digital-hourglass/08-digital-hourglass.ino
danpeczek/arduino-starter
8ea4957fee83da6a87330e9015433755f496dd06
[ "MIT" ]
null
null
null
08-digital-hourglass/08-digital-hourglass.ino
danpeczek/arduino-starter
8ea4957fee83da6a87330e9015433755f496dd06
[ "MIT" ]
null
null
null
08-digital-hourglass/08-digital-hourglass.ino
danpeczek/arduino-starter
8ea4957fee83da6a87330e9015433755f496dd06
[ "MIT" ]
0
null
null
const int switchPin = 8; unsigned long previousTime = 0; int switchState = 0; int prevSwitchState = 0; int led = 2; long interval = 10000; void setup() { for (int x = 2; x < 8; ++x) { pinMode(x, OUTPUT); } pinMode(switchPin, INPUT); } void loop() { unsigned long currentTime = millis(); if (currentTime - previousTime > interval) { previousTime = currentTime; digitalWrite(led, HIGH); led++; if (led == 7) { return } } switchState = digitalRead(switchPin); if (switchState != prevSwitchState) { for (int x = 2; x<8; ++x) { digitalWrite(x, LOW); } led = 2; previousTime = currentTime; } prevSwitchState = switchState; }
17.475
46
0.60372
true
207
99f868ac091ba3a6eaa9b3d2829a2c0a0e78cc58
1,739
ino
Arduino
examples/TestMoveAtVelocity/TestMoveAtVelocity.ino
hjd1964/TMC2209
0c0caf2d1cb0a0144a6b290875d84e0647814997
[ "BSD-3-Clause" ]
null
null
null
examples/TestMoveAtVelocity/TestMoveAtVelocity.ino
hjd1964/TMC2209
0c0caf2d1cb0a0144a6b290875d84e0647814997
[ "BSD-3-Clause" ]
null
null
null
examples/TestMoveAtVelocity/TestMoveAtVelocity.ino
hjd1964/TMC2209
0c0caf2d1cb0a0144a6b290875d84e0647814997
[ "BSD-3-Clause" ]
0
null
null
#include <Arduino.h> #include <TMC2209.h> HardwareSerial & serial_stream = Serial1; const long SERIAL_BAUD_RATE = 115200; const int DELAY = 2000; const int32_t VELOCITY = 2000; const uint8_t RUN_CURRENT_PERCENT = 40; // Instantiate TMC2209 TMC2209 stepper_driver; void setup() { Serial.begin(SERIAL_BAUD_RATE); stepper_driver.setup(serial_stream, 115200, 0); stepper_driver.setMicrostepsPerStep(32); if (stepper_driver.isSetupAndCommunicating()) { Serial.println("Stepper driver setup and communicating!"); Serial.println(""); } else { Serial.println("Stepper driver not setup and communicating!"); return; } stepper_driver.setRunCurrent(RUN_CURRENT_PERCENT); stepper_driver.enable(); stepper_driver.moveAtVelocity(VELOCITY); } void loop() { if (not stepper_driver.isSetupAndCommunicating()) { Serial.println("Stepper driver not setup and communicating!"); return; } bool disabled_by_input_pin = stepper_driver.disabledByInputPin(); TMC2209::Settings settings = stepper_driver.getSettings(); TMC2209::Status status = stepper_driver.getStatus(); if (disabled_by_input_pin) { Serial.println("Stepper driver is disabled by input pin!"); } else if (not settings.enabled && false) { Serial.println("Stepper driver is disabled by firmware!"); } else if ((not status.standstill)) { Serial.print("Moving at velocity "); Serial.println(VELOCITY); uint32_t interstep_duration = stepper_driver.getInterstepDuration(); Serial.print("which is equal to an interstep_duration of "); Serial.println(interstep_duration); } else { Serial.println("Not moving, something is wrong!"); } Serial.println(""); delay(DELAY); }
22.584416
72
0.720529
true
419
8277c87af056c7d45384aa6910d76f2b3cd8d134
4,584
ino
Arduino
src/arduino/ReadFSR/ReadFSR.ino
iordic/Forcemeter
908b5081091e9d9732203f442264fd141d32e68b
[ "MIT" ]
null
null
null
src/arduino/ReadFSR/ReadFSR.ino
iordic/Forcemeter
908b5081091e9d9732203f442264fd141d32e68b
[ "MIT" ]
null
null
null
src/arduino/ReadFSR/ReadFSR.ino
iordic/Forcemeter
908b5081091e9d9732203f442264fd141d32e68b
[ "MIT" ]
0
null
null
/* Force reading with FSR * ================================== * Read values from FSR in the A0 pin. This values are displayed in a 16x2 LCD Screen * and data is send through serial port in JSON format. * * Author: Jordi Castelló */ #include <LiquidCrystal.h> // Pines y constantes: const int fsrPin = 0; // FSR connected to A0 pin with 10K pulldown resistor const int piezoPin = 6; // Beeper connected to pin number 6 (this pin can implement PWM) const int tarButton = 7; // Digital pins const int lockButton = 8; byte padlockClose[8] = { B01110, B10001, B10001, B10001, B11111, B11011, B11011, B01110 }; // Locked Symbol byte padlockOpen[8] = { B01110, B10001, B10000, B10000, B11111, B11011, B11011, B01110 }; // Unlocked Symbol LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // lcd(RS,Enable,D4,D5,D6,D7) // Variables: int tarButtonValue, lockButtonValue, fsrReading; boolean locked = false, tared; // if true, screen value is locked. // Calculation variables: long fsrForce; // Finally, the resistance converted to force long fsrForceTar = 0L; void setup() { Serial.begin(9600); pinMode(piezoPin, OUTPUT); pinMode(tarButton, INPUT_PULLUP); // Buttons connected between GND & pin. pinMode(lockButton, INPUT_PULLUP); // Internal pull-up configuration. lcd.createChar(0, padlockOpen); lcd.createChar(1, padlockClose); lcd.begin(16, 2); // LCD has 16 columns & 2 rows. } void loop() { tarButtonValue = digitalRead(tarButton); lockButtonValue = digitalRead(lockButton); lcd.setCursor(0,0); // Set cursor position at screen (column, row) lcd.print("Force in Newtons"); lcd.setCursor(0,1); // (column, row) lcd.print("F: "); lcd.setCursor(3,1); lcd.print(fsrForce); lcd.print(" N"); lcd.print(" "); lcd.setCursor(14,1); // Lock symbol position if(lockButtonValue == LOW && locked == true){ waitKeyUp(lockButton); locked = false; } else if(lockButtonValue == LOW && locked == false){ waitKeyUp(lockButton); locked = true; } if(!locked){ fsrCalc(); lcd.write(byte(0)); } else { lcd.write(byte(1)); } if(tarButtonValue == LOW && tared){ waitKeyUp(tarButton); fsrForceTar = 0L; tared = false; } else if(tarButtonValue == LOW && !tared) { waitKeyUp(tarButton); setTare(); tared = true; } if(lockButtonValue == LOW || tarButtonValue == LOW){ tone(piezoPin, 3000, 50); // Beep (pin, frecuency <hz>, duration <ms>) } if(tared) lcd.write("T"); else lcd.write(" "); // We send values with JSON format: Serial.print("{\"force\":"); Serial.print(fsrForce); Serial.print(",\"raw\":"); Serial.print(fsrReading); Serial.println("}"); delay(150); } /** * Do force calculations with the analog pin reads. */ void fsrCalc() { // Code from Adafruit FSR (a bit modified). int fsrVoltage; // the analog reading converted to voltage unsigned long fsrResistance; // The voltage converted to resistance, can be very big so make "long" unsigned long fsrConductance; fsrReading = analogRead(fsrPin); // analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV) fsrVoltage = map(fsrReading, 0, 1023, 0, 5000); if (fsrVoltage == 0) { fsrForce = 0; } else { // The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V // so FSR = ((Vcc - V) * R) / V yay math! fsrResistance = 5000 - fsrVoltage; // fsrVoltage is in millivolts so 5V = 5000mV fsrResistance *= 10000; // 10K resistor fsrResistance /= fsrVoltage; fsrConductance = 1000000; // we measure in micromhos so fsrConductance /= fsrResistance; // Use the two FSR guide graphs to approximate the force if (fsrConductance <= 1000) { fsrForce = fsrConductance / 80; } else { fsrForce = fsrConductance - 1000; fsrForce /= 30; } fsrForce = fsrForce - fsrForceTar; } } /** * Set the current force value as if it were the actual force value. */ void setTare() { fsrCalc(); fsrForceTar = fsrForce; } /** * Wait here until we release pressed button. */ void waitKeyUp(int button) { delay(10); while(digitalRead(button) == LOW) { delay(10); } }
32.742857
112
0.592932
true
1,358
cd13ba6bf041ed8438ccc153f95e4529b8c53972
954
ino
Arduino
ServoFeedback/ServoFeedback.ino
Darren-Mc/Arduino
700af8a68b02f3d5af98413907bd839c5a2d1e9c
[ "Apache-2.0" ]
null
null
null
ServoFeedback/ServoFeedback.ino
Darren-Mc/Arduino
700af8a68b02f3d5af98413907bd839c5a2d1e9c
[ "Apache-2.0" ]
null
null
null
ServoFeedback/ServoFeedback.ino
Darren-Mc/Arduino
700af8a68b02f3d5af98413907bd839c5a2d1e9c
[ "Apache-2.0" ]
0
null
null
/* Sweep by BARRAGAN <http://barraganstudio.com> This example code is in the public domain. modified 8 Nov 2013 by Scott Fitzgerald http://arduino.cc/en/Tutorial/Sweep */ #include <Servo.h> #include <Filter.h> Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo position int dpos = 1; long int count = 0; unsigned long prev = 0; Filter<uint16_t> w(100); void setup() { Serial.begin(9600); myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { unsigned long ms = millis(); w.push(analogRead(A0)); count++; if ( ms - prev > 15 ) { Serial.print(pos); Serial.print('\t'); Serial.println(w.mean()); if(pos == 0) dpos = 1; else if (pos == 180) dpos = -1; pos = pos+dpos; prev = millis(); myservo.write(pos); count = 0; } }
19.875
73
0.615304
true
284
a1e1e5220f6a2757fbd2e1d355c0b9be8f675943
2,553
ino
Arduino
examples/T-Block/CapTouch/CapTouch.ino
sparquay/TTGO_TWatch_Library
4f37e5f31f3d02f436183590a056f90a221721b6
[ "MIT" ]
null
null
null
examples/T-Block/CapTouch/CapTouch.ino
sparquay/TTGO_TWatch_Library
4f37e5f31f3d02f436183590a056f90a221721b6
[ "MIT" ]
null
null
null
examples/T-Block/CapTouch/CapTouch.ino
sparquay/TTGO_TWatch_Library
4f37e5f31f3d02f436183590a056f90a221721b6
[ "MIT" ]
0
null
null
#include <TTGO.h> #include <MPR121.h> #define MPR121_SDA_PIN 19 #define MPR121_SCL_PIN 18 #define MPR121_IRQ_PIN 34 #define MPR121_BL_PIN 12 #define MPR121_BUZZER_PIN 23 TTGOClass *ttgo = nullptr; MPR121_Class cap; uint16_t lasttouched = 0; uint16_t currtouched = 0; bool enterComplete = false; String tmpPassword = ""; #define KEYBOARD_PASSWORD "12345678" const char *keyboard[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"}; void playSound(int s) { for (int i = 0; i < s; i++) { ledcWriteTone(10, 1000); delay(200); ledcWrite(10, 0); } } void setup() { Serial.begin(115200); ttgo = TTGOClass::getWatch(); ttgo->begin(false, false); Wire1.begin(MPR121_SDA_PIN, MPR121_SCL_PIN); ttgo->openBL(); delay(2000); ttgo->closeBL(); if (!cap.begin()) { Serial.println("MPR121 not found, check wiring?"); while (1); } Serial.println("MPR121 found!"); ledcAttachPin(MPR121_BUZZER_PIN, 10); ledcSetup(10, 12000, 8); ledcWrite(10, 0); playSound(2); } void loop() { ttgo->button->loop(); // Get the currently touched pads currtouched = cap.touched(); for (uint8_t i = 0; i < 12; i++) { // it if *is* touched and *wasnt* touched before, alert! if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) { playSound(1); const char *keyVal = keyboard[i]; if (String(keyVal).equals("*")) { Serial.println("***"); } else if (String(keyVal).equals("#")) { Serial.println("####"); enterComplete = true; } else { Serial.println(keyVal); tmpPassword += keyVal; } } if (enterComplete) { enterComplete = false; if (tmpPassword == KEYBOARD_PASSWORD) { Serial.println("Success"); playSound(4); } else { Serial.println("Failed"); // playSound(4); for (int i = 0; i < 4; i++) { ttgo->closeBL(); playSound(1); delay(200); ttgo->openBL(); delay(200); playSound(1); } } tmpPassword = ""; } } // reset our state lasttouched = currtouched; }
26.59375
87
0.476694
true
672
576e92a9e42af3e7c2f15ca360ecc67fc2a38fdc
3,048
ino
Arduino
arduino/OTOsense_gravity_blink/OTOsense_gravity_blink.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
null
null
null
arduino/OTOsense_gravity_blink/OTOsense_gravity_blink.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
null
null
null
arduino/OTOsense_gravity_blink/OTOsense_gravity_blink.ino
reinforce-lab/iOSPhysicalComputing01
e572847cd7a78bcf961bf5e475ec3d759cce756f
[ "MIT", "Unlicense" ]
0
null
null
/* * OTOsense_slider_blink.ino - iPhone sensor shield base sketch * Copyright (C) 2012 REINFORCE Lab. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the MIT license. * */ #include <OTOReceiver1200.h> // **** // 定義 // **** #define SERIAL_DEBUG 1 // **** // 変数 // **** uint8_t rcvBuf[MAX_PACKET_SIZE]; uint8_t rcvLength; // packet receiver method void packetReceivedCallback(const uint8_t *buf, uint8_t length) { if(length == 0 || rcvLength != 0) return; // copy buffer for(int i=0; i < length; i++) { rcvBuf[i] = buf[i]; } rcvLength = length; } // packet dump #if SERIAL_DEBUG void packetDump(const uint8_t *buf, uint8_t length) { Serial.print("Packet(len:"); Serial.print(length, DEC); Serial.print(")"); for(int i=0; i < length; i++) { Serial.print(", "); Serial.print(buf[i], HEX); } Serial.println(""); } #endif #define BUTTONS_PACKET_ID 0x01 #define SLIDEBAR_PACKET_ID 0x02 #define ACCS_PACKET_ID 0x03 #define GYRO_PACKET_ID 0x04 #define COMP_PACKET_ID 0x05 #define FACE_PACKET_ID 0x06 // LEDポート。左を_L, 真ん中を_C, 右を_R、の添字で表す。 const int LED_L = 2; const int LED_C = 3; const int LED_R = 4; #define TIME_OUT 2000 unsigned long lastPacketReceivedAt; void setup() { #if SERIAL_DEBUG Serial.begin(115200); Serial.println("Start:"); #endif for(int i = 2; i < 5; i++) { pinMode(i, OUTPUT); digitalWrite(i, HIGH); } OTOReceiver1200.begin(); OTOReceiver1200.attach(packetReceivedCallback); //パケット通信断絶検出のための、最終受信時刻の記録 lastPacketReceivedAt = millis(); } void loop() { if(rcvLength == 0) { //断絶検出処理 unsigned long nowTime = millis(); //通信断絶->LEDを全て点灯 if((nowTime - lastPacketReceivedAt) > TIME_OUT) { //ここのポート番号指定は、マジックワードでよくないが、LED_L, _C, _Rの数の大小関係がわからないから、数字で直接書く for(int i = 2; i < 5; i++) { digitalWrite(i, HIGH); } } } else { //パケット受信時刻を更新 lastPacketReceivedAt = millis(); //加速度センサーのパケットかどうかを判別 if(rcvBuf[0] == ACCS_PACKET_ID) { //真ん中、左、右 float x_acs = (float)((int8_t)rcvBuf[1]); float z_acs = (float)((int8_t)rcvBuf[3]); /* デバッグ用の加速度ダンプ #if SERIAL_DEBUG Serial.print("x_acs:"); Serial.println(x_acs, 2); Serial.print(" z_acs:"); Serial.println(z_acs, 2); #endif */ //tan(30度) = 0.577, tan(45度) = 1.0, tan(60度) = 1.73 // 60度以上の傾きを検出する if( abs(z_acs) > 1.73 * abs(x_acs)) { //真ん中 digitalWrite(LED_L, LOW); digitalWrite(LED_C, HIGH); digitalWrite(LED_R, LOW); } else { //左か右に傾いている if(x_acs > 0) { //右に傾いている digitalWrite(LED_L, LOW); digitalWrite(LED_C, LOW); digitalWrite(LED_R, HIGH); } else { //左に傾いている digitalWrite(LED_L, HIGH); digitalWrite(LED_C, LOW); digitalWrite(LED_R, LOW); } } } #if SERIAL_DEBUG packetDump(rcvBuf, rcvLength); #endif rcvLength = 0; } }
21.02069
70
0.608924
true
1,016
0ff8ac4a0882908e4290cf4785152acee37c0f4f
3,390
ino
Arduino
arduino_doc/Arduino/Arduino.ino
FaustoPegado/ServidorAviario
129be045d6bb0ae763743541f4bee218a71bb4ac
[ "MIT" ]
null
null
null
arduino_doc/Arduino/Arduino.ino
FaustoPegado/ServidorAviario
129be045d6bb0ae763743541f4bee218a71bb4ac
[ "MIT" ]
null
null
null
arduino_doc/Arduino/Arduino.ino
FaustoPegado/ServidorAviario
129be045d6bb0ae763743541f4bee218a71bb4ac
[ "MIT" ]
0
null
null
/*================================================================== * Arquivo: arduinoComunicationSport * Descrição: Comunicaço SerialPort do arduino com o Node.js * Author: Fausto Pegado * Data de Criação: 28/03/2017 ==================================================================*/ #include <dht.h> #define dht_dpin A1 dht DHT; //Inicializa o sensor String pin = "", state = "", temperatureMax = "", temperatureMin = ""; float temperatureAviario1 = 0; char message[20]; int i = 0; void setup() { Serial.begin(9600); for(i = 2; i <= 13; i++){ pinMode(i, OUTPUT); } } void loop() { pin = ""; state = ""; temperatureMax = ""; temperatureMin = ""; readStringSerialPort(); temperatureAviario1 = checTemperature(); Serial.println (pin); Serial.println (state); Serial.println (temperatureMax); Serial.println (temperatureMin); //a funçao atoi tem como finalidade transformar strinc em numerico int exitDor = atoi( pin.c_str() ); /*recebe um valor numerico que refere-se ao pino de saida */ switch (exitDor) { case 2: switchState(2, state); break; case 3: switchState(3, state); break; case 4: switchState(4, state); break; case 5: switchState(5, state); break; case 6: switchState(6, state); break; case 7: switchState(7, state); break; case 8: switchState(8, state); break; case 9: switchState(9, state); break; case 10: switchState(10, state); break; case 11: switchState(11, state); break; case 12: switchState(12, state); break; case 13: switchState(13, state); break; default: break; } delay (200); } void readStringSerialPort () { int i = 0; while (Serial.available() > 0) { char c = Serial.read(); message[i] = c; i++; } sortMessage(); } /*Pega a mensagem que a funcao readStringSerialPort() recuperou e separa para cada variavel. */ void sortMessage () { int cont = 0; for (int i = 0; i<sizeof(message); i++) { if (message[i] != ';' && cont < 2) { pin = pin + message[i]; } else if (message[i] != ';' && cont==3) { state = state + message[i]; } else if (message[i] != ';' && cont==6) { temperatureMax = temperatureMax + message[i]; } else if (message[i] != ';' && cont==9) { temperatureMin = temperatureMin + message[i]; } cont++; } } /*Funçao para leitura da porta serial. */ void switchState(int pino, String state) { if(state == "0"){ digitalWrite (pino, HIGH); } if(state == "1"){ digitalWrite (pino, LOW); } } /*Funcao para checar a temperatura */ float checTemperature() { DHT.read11(dht_dpin); //Lê as informações do sensor //Serial.print("Temperatura = "); Serial.println(DHT.temperature); //Serial.println(" Celsius "); // if(temperaturaBalde > 40.00){ // pino = "11"; // estado = "0"; // }else if (temperaturaBalde <= 35.00){ // pino = "11"; // estado = "1"; // } return (float) DHT.temperature; } /*Funcao checar a para humidade */ float checHumidity() { DHT.read11(dht_dpin); //Lê as informações do sensor //Serial.print("Umidade = "); //Serial.print(DHT.humidity); //Serial.print(" % "); return DHT.humidity; }
20.059172
72
0.555752
true
979
a192c04eb3aceb6de0afb4d5fb74b09faf47a467
13,269
ino
Arduino
_433nIRtoMQTTto433nIR_ESP8266.ino
prahjister/433toMQTTto433_ESP8266
9b3d4d079bbb2589f940c71aa665947c6f2d1886
[ "Unlicense" ]
11
2017-03-05T17:43:30.000Z
2021-11-21T23:22:25.000Z
_433nIRtoMQTTto433nIR_ESP8266.ino
prahjister/433toMQTTto433_ESP8266
9b3d4d079bbb2589f940c71aa665947c6f2d1886
[ "Unlicense" ]
null
null
null
_433nIRtoMQTTto433nIR_ESP8266.ino
prahjister/433toMQTTto433_ESP8266
9b3d4d079bbb2589f940c71aa665947c6f2d1886
[ "Unlicense" ]
6
2018-03-18T02:58:35.000Z
2021-02-12T04:34:46.000Z
/* 433nIRtoMQTTto433nIR - ESP8266 program for home automation Tested OK on GeekCreek ESP12F Not working on NodeMCU V0.9 Act as a wifi gateway between your 433mhz/infrared IR signal and a MQTT broker Send and receiving command by MQTT This program enables to: - receive MQTT data from a topic and send RF 433Mhz signal corresponding to the received MQTT data - publish MQTT data to a different topic related to received 433Mhz signal - receive MQTT data from a topic and send IR signal corresponding to the received MQTT data - publish MQTT data to a different topic related to received IR signal Contributors: - 1technophile - crankyoldgit Based on: - MQTT library (https://github.com/knolleary) - RCSwitch (https://github.com/sui77/rc-switch) - ESP8266Wifi - IRremoteESP8266 (https://github.com/markszabo/IRremoteESP8266) Project home: https://github.com/1technophile/433nIRtoMQTTto433nIR_ESP8266 Blog, tutorial: http://1technophile.blogspot.com/2016/09/433nIRtomqttto433nIR-bidirectional-esp8266.html Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Some usefull commands to test gateway with mosquitto: Subscribe to the subject for data receiption from RF signal mosquitto_sub -t home/433toMQTT Send data by MQTT to convert it on RF signal mosquitto_pub -t home/MQTTto433/ -m 1315153 */ #include <ESP8266WiFi.h> #include <PubSubClient.h> #include <RCSwitch.h> // library for controling Radio frequency switch #include <SoftwareSerial.h> int incomingByte = 0;// for incoming serial data int outByte = 0; // software serial : TX = digital pin 12, RX = digital pin 14 SoftwareSerial portOne(14, 12); RCSwitch mySwitch = RCSwitch(); //Do we want to see trace for debugging purposes #define TRACE 1 // 0= trace off 1 = trace on // Update these with values suitable for your network. #define wifi_ssid "SSID" #define wifi_password "password" #define mqtt_server "x.x.x.x" #define mqtt_user "your_username" // not compulsory if you set it uncomment line 143 and comment line 145 #define mqtt_password "your_password" // not compulsory if you set it uncomment line 143 and comment line 145 //variables to avoid duplicates for RF #define time_avoid_duplicate 3000 // if you want to avoid duplicate mqtt message received set this to > 0, the value is the time in milliseconds during which we don't publish duplicates // array to store previous received RFs codes and their timestamps long ReceivedRF[10][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; #define subjectMQTTtoX "home/commands/#" //RF MQTT Subjects #define subject433toMQTT "home/433toMQTT" #define subjectMQTTto433 "home/commands/MQTTto433" //IR MQTT Subjects #define subjectIRtoMQTT "home/sensors/ir" #define subjectMQTTtoIR "home/commands/MQTTtoIR" //adding this to bypass to problem of the arduino builder issue 50 void callback(char*topic, byte* payload,unsigned int length); WiFiClient espClient; // client parameters PubSubClient client(mqtt_server, 1883, callback, espClient); //MQTT last attemps reconnection number long lastReconnectAttempt = 0; //Light Reading********************************************** unsigned long previousLightMillis = 0; const int lightInterval = 120000; //Temp Sensor************************************************ #include <dht.h> dht DHT; #define DHT11_PIN 12 int inPin = 12; // Callback function, when the gateway receive an MQTT value on the topics subscribed this function is called void callback(char* topic, byte* payload, unsigned int length) { // In order to republish this payload, a copy must be made // as the orignal payload buffer will be overwritten whilst // constructing the PUBLISH packet. trc("Hey I got a callback "); // Allocate the correct amount of memory for the payload copy byte* p = (byte*)malloc(length + 1); // Copy the payload to the new buffer memcpy(p,payload,length); // Conversion to a printable string p[length] = '\0'; String callbackstring = String((char *) p); String topicNameRec = String((char*) topic); //launch the function to treat received data receivingMQTT(topicNameRec,callbackstring); // Free the memory free(p); } void setup() { //Launch serial for debugging purposes Serial.begin(9600); // Start IR software serial ports portOne.begin(9600); //Begining wifi connection setup_wifi(); delay(1500); lastReconnectAttempt = 0; //RF init parameters mySwitch.enableTransmit(4); // RF Transmitter is connected to Pin D2 mySwitch.setRepeatTransmit(20); //increase transmit repeat to avoid lost of rf sendings mySwitch.enableReceive(5); // Receiver on pin D1 } void setup_wifi() { delay(10); // We start by connecting to a WiFi network trc("Connecting to "); trc(wifi_ssid); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { delay(500); trc("."); } trc("WiFi connected"); } boolean reconnect() { // Loop until we're reconnected while (!client.connected()) { trc("Attempting MQTT connection..."); // Attempt to connect // If you want to use a username and password, uncomment next line and comment the line if (client.connect("433toMQTTto433")) { //if (client.connect("433nIRtoMQTTto433nIR", mqtt_user, mqtt_password)) { // and set username and password at the program beginning if (client.connect("433nIRtoMQTTto433nIR")) { // Once connected, publish an announcement... client.publish("outTopic","hello world"); trc("connected"); //Subscribing to topic(s) subscribing(subjectMQTTtoX); } else { trc("failed, rc="); trc(String(client.state())); trc(" try again in 5 seconds"); // Wait 5 seconds before retrying delay(5000); } } return client.connected(); } void loop() { //Start Extra Sensors extraSensor(); //MQTT client connexion management if (!client.connected()) { long now = millis(); if (now - lastReconnectAttempt > 5000) { lastReconnectAttempt = now; trc("client mqtt not connected, trying to connect"); // Attempt to reconnect if (reconnect()) { lastReconnectAttempt = 0; } } } else { // MQTT loop client.loop(); } // Receive loop, if data received by RF433 send it by MQTT to subject433toMQTT if (mySwitch.available()) { // Topic on which we will send data trc("Receiving 433Mhz signal"); unsigned long MQTTvalue; MQTTvalue=mySwitch.getReceivedValue(); mySwitch.resetAvailable(); if (client.connected()) { if (!isAduplicate(MQTTvalue)) {// conditions to avoid duplications of RF -->MQTT trc("Sending 433Mhz signal to MQTT"); trc(String(MQTTvalue)); sendMQTT(subject433toMQTT,String(MQTTvalue)); storeValue(MQTTvalue); } } else { if (reconnect()) { trc("Sending 433Mhz signal to MQTT after reconnect"); trc(String(MQTTvalue)); sendMQTT(subject433toMQTT,String(MQTTvalue)); storeValue(MQTTvalue); lastReconnectAttempt = 0; } } } delay(100); //begining of IR if (portOne.available() > 0) { delay(1); int my_in_bytes[3]={0, 0, 0}; for (int i=0; i <= 2; i++){ incomingByte = portOne.read(); Serial.print("I received: "); Serial.println (String (incomingByte, HEX)); my_in_bytes [i] = incomingByte; } String IRvalue; for (int i=0; i <= 2; i++){ Serial.print(String (my_in_bytes [i], HEX) + "," ); IRvalue = IRvalue + (String (my_in_bytes [i], HEX) + "," ); } Serial.println(""); sendMQTT(subjectIRtoMQTT,String(IRvalue)); } //end of IR } void storeValue(long MQTTvalue){ long now = millis(); // find oldest value of the buffer int o = getMin(); trc("Minimum index: " + String(o)); // replace it by the new one ReceivedRF[o][0] = MQTTvalue; ReceivedRF[o][1] = now; trc("send this code :" + String(ReceivedRF[o][0])+"/"+String(ReceivedRF[o][1])); trc("Col: value/timestamp"); for (int i = 0; i < 10; i++) { trc(String(i) + ":" + String(ReceivedRF[i][0])+"/"+String(ReceivedRF[i][1])); } } int getMin(){ int minimum = ReceivedRF[0][1]; int minindex=0; for (int i = 0; i < 10; i++) { if (ReceivedRF[i][1] < minimum) { minimum = ReceivedRF[i][1]; minindex = i; } } return minindex; } boolean isAduplicate(long value){ trc("isAduplicate"); // check if the value has been already sent during the last "time_avoid_duplicate" for (int i=0; i<10;i++){ if (ReceivedRF[i][0] == value){ long now = millis(); if (now - ReceivedRF[i][1] < time_avoid_duplicate){ trc("don't send this code :" + String(ReceivedRF[i][0])+"/"+String(ReceivedRF[i][1])); return true; } } } return false; } void subscribing(String topicNameRec){ // MQTT subscribing to topic char topicStrRec[26]; topicNameRec.toCharArray(topicStrRec,26); // subscription to topic for receiving data boolean pubresult = client.subscribe(topicStrRec); if (pubresult) { trc("subscription OK to"); trc(topicNameRec); } } void receivingMQTT(String topicNameRec, String callbackstring) { trc("Receiving data by MQTT"); trc(topicNameRec); char topicOri[26] = ""; char topicStrAck[26] = ""; char datacallback[32] = ""; // Acknowledgement inside a subtopic to avoid loop topicNameRec.toCharArray(topicOri,26); char DataAck[26] = "OK"; client.publish("home/ack", DataAck); callbackstring.toCharArray(datacallback,32); trc(datacallback); unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass value > 4294967295 trc(String(data)); if (topicNameRec == subjectMQTTto433){ trc("Send received data by RF 433"); //send received MQTT value by RF signal (example of signal sent data = 5264660) mySwitch.send(data, 24); } //IR Recieved if (topicNameRec = subjectMQTTtoIR){ char input1[3]; char input2[3]; char input3[3]; int val1; int val2; int val3; uint8_t my_out_bytes[5]={0xA1, 0xF1, 0, 0, 0}; int commaIndex = callbackstring.indexOf(','); // Search for the next comma just after the first int secondCommaIndex = callbackstring.indexOf(',', commaIndex + 1); String firstValue = callbackstring.substring(0, commaIndex); String secondValue = callbackstring.substring(commaIndex + 1, secondCommaIndex); String thirdValue = callbackstring.substring(secondCommaIndex + 1); // To the end of the string firstValue.toCharArray(input1, 4); val1 = StrToHex(input1); my_out_bytes [2] = val1; secondValue.toCharArray(input2, 4); val2 = StrToHex(input2); my_out_bytes [3] = val2; thirdValue.toCharArray(input3, 4); val3 = StrToHex(input3); my_out_bytes [4] = val3; for (int i=0; i <= 4; i++){ Serial.print(String (my_out_bytes [i], HEX) + "," ); } portOne.write(my_out_bytes,sizeof(my_out_bytes)); Serial.println(""); } } //send MQTT data dataStr to topic topicNameSend void sendMQTT(String topicNameSend, String dataStr){ char topicStrSend[26]; topicNameSend.toCharArray(topicStrSend,26); char dataStrSend[200]; dataStr.toCharArray(dataStrSend,200); boolean pubresult = client.publish(topicStrSend,dataStrSend); trc("sending "); trc(dataStr); trc("to "); trc(topicNameSend); } //trace void trc(String msg){ if (TRACE) { Serial.println(msg); } } //More Sensors void extraSensor() { if (millis() - previousLightMillis >= lightInterval) { //Read Analog Light Sensor int sensorValue = analogRead(A0); Serial.println(sensorValue); previousLightMillis = millis(); String lighttopic = "home/Light"; sendMQTT(lighttopic,String(sensorValue)); //Read DHT Sensor int chk = DHT.read11(DHT11_PIN); float temp = DHT.temperature; Serial.print("Temperature = "); Serial.println(1.8*temp+32); Serial.print("Humidity = "); Serial.println(DHT.humidity); String temptopic = "home/DHT/temp"; sendMQTT(temptopic,String(1.8*temp+32)); String humiditytopic = "home/DHT/humidity"; sendMQTT(humiditytopic,String(DHT.humidity)); } } //IR String to Hex Conversion int StrToHex(char str[]) { return (int) strtol(str, 0, 16); }
31.147887
185
0.687618
true
3,552
b5352183117ce86e418b5905ce11a67b6f8551ef
149
ino
Arduino
Test Code/StepperGPS_TestPWM/stepperControl.ino
efield/Autonomous-Vehicle
76bc9af9f0b653555ee51f719eeb227e9a937830
[ "MIT" ]
null
null
null
Test Code/StepperGPS_TestPWM/stepperControl.ino
efield/Autonomous-Vehicle
76bc9af9f0b653555ee51f719eeb227e9a937830
[ "MIT" ]
null
null
null
Test Code/StepperGPS_TestPWM/stepperControl.ino
efield/Autonomous-Vehicle
76bc9af9f0b653555ee51f719eeb227e9a937830
[ "MIT" ]
0
null
null
void driveSteppers(int stepDelay2_4, int stepDelay1_3) { analogWrite(stepperPin1_3,stepDelay1_3); analogWrite(stepperPin2_4,stepDelay2_4); }
21.285714
56
0.798658
true
56
bd0c9bca384426751fac8d5b89c4c97183dae2c0
936
ino
Arduino
examples/Effects/universal/ThreeColor/ThreeColor.ino
xdzmkus/LEDStrip
a03e17d928b9c0d32f930ee25008af1bcea0d8cf
[ "MIT" ]
null
null
null
examples/Effects/universal/ThreeColor/ThreeColor.ino
xdzmkus/LEDStrip
a03e17d928b9c0d32f930ee25008af1bcea0d8cf
[ "MIT" ]
null
null
null
examples/Effects/universal/ThreeColor/ThreeColor.ino
xdzmkus/LEDStrip
a03e17d928b9c0d32f930ee25008af1bcea0d8cf
[ "MIT" ]
0
null
null
#if defined(ESP8266) #define LED_PIN D1 // D1 leds pin (connected to D5 on my NodeMCU1.0 !!!) #else #define LED_PIN 9 // leds pin #endif #define UNPINNED_ANALOG_PIN A0 // not connected analog pin #define NUM_LEDS 256 #define RATE_HZ 50 #define CURRENT_LIMIT 8000 uint8_t brightness = 128; #include <FastLED.h> CRGB leds[NUM_LEDS]; #include "UniversalLEDLineEffects.h" ThreeColorLedEffect<leds, NUM_LEDS> effect(RATE_HZ, { CRGB::White, 2, CRGB::Red, 4, CRGB::White, 2 }); void setupLED() { FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS); FastLED.setMaxPowerInVoltsAndMilliamps(5, CURRENT_LIMIT); FastLED.setBrightness(brightness); FastLED.clear(true); } void setup() { randomSeed(analogRead(UNPINNED_ANALOG_PIN)); Serial.begin(115200); Serial.print(F("Effect: ")); Serial.println(effect.name); setupLED(); effect.start(); } void loop() { if (effect.isReady()) { effect.paint(); FastLED.show(); } }
18.72
102
0.721154
true
288
b7031a205a48a93d446e0e52171a82e78cef6e21
5,197
ino
Arduino
DramTester.ino
andreyugolnik/DramTester
77edf42db859a528e504958ad29b0e156b192493
[ "MIT" ]
null
null
null
DramTester.ino
andreyugolnik/DramTester
77edf42db859a528e504958ad29b0e156b192493
[ "MIT" ]
null
null
null
DramTester.ino
andreyugolnik/DramTester
77edf42db859a528e504958ad29b0e156b192493
[ "MIT" ]
0
null
null
/**********************************************\ * * Andrey A. Ugolnik * http://www.ugolnik.info * andrey@ugolnik.info * \**********************************************/ #include "src/Button.h" #include "src/Dram.h" #include "src/Led.h" #include "src/LedsList.h" #include "src/PinsConfig.h" #include "src/TestPlain.h" #include "src/TestRandom.h" #include "src/TestReversed.h" // ----------------------------------------------------------------------------- const bool Verbose = false; // ----------------------------------------------------------------------------- enum class State { Idle, Testing }; static State CurrentState = State::Idle; struct TestProp { enum class Type { Plain, Reversed, Random, }; Type type; uint32_t value; }; static const TestProp TestsList[] = { { TestProp::Type::Plain, 0 }, { TestProp::Type::Reversed, 1 }, { TestProp::Type::Plain, 1 }, { TestProp::Type::Reversed, 0 }, { TestProp::Type::Random, 0 }, { TestProp::Type::Random, 0 }, { TestProp::Type::Plain, 1 }, { TestProp::Type::Plain, 0 }, { TestProp::Type::Reversed, 0 }, { TestProp::Type::Reversed, 1 }, { TestProp::Type::Random, 0 }, { TestProp::Type::Random, 0 }, }; // ----------------------------------------------------------------------------- static void readyToTestChipMessage() { Serial.println(""); Serial.println("o======================================================o"); Serial.println("| Insert DRAM and press Start button |"); Serial.println("o======================================================o"); Serial.println(""); Serial.flush(); } static void showGoodRamMessage() { Serial.println(""); Serial.println(" o=========================o"); Serial.println(" | |"); Serial.println(" | All tests is done |"); Serial.println(" | DRAM is OK! |"); Serial.println(" | |"); Serial.println(" o=========================o"); readyToTestChipMessage(); } static void showBadRamMessage() { Serial.println(""); Serial.println(" o===========================o"); Serial.println(" | |"); Serial.println(" | DRAM has BAD cells! |"); Serial.println(" | |"); Serial.println(" o===========================o"); readyToTestChipMessage(); } // ----------------------------------------------------------------------------- int main() { init(); Serial.begin(9600); while (!Serial) { _delay_us(100); } Serial.println("DRAM Tester v0.2 / Feb 20, 2022"); Serial.println("by Andrey A. Ugolnik"); Serial.println(""); cDram dram; const char* chipType = "64Kx1"; if (dram.getAddressBits() == 9) { chipType = "256Kx1"; } Serial.println("Testing DRAM " + String(chipType) + " with " + String(dram.getAddressBits()) + " address line bits"); readyToTestChipMessage(); cLedsList ledsList; ledsList.switchOff(); cButton btnStart(BTN_START); cTestPlain testPlain(Verbose); cTestReversed testReversed(Verbose); cTestRandom testRandom(Verbose); uint32_t CurrentTestIndex = 0; while (true) { if (CurrentState == State::Testing) { cTest::Result result = cTest::Result::OK; const TestProp& prop = TestsList[CurrentTestIndex]; switch (prop.type) { case TestProp::Type::Plain: result = testPlain.doTest(prop.value, dram, ledsList); break; case TestProp::Type::Reversed: result = testReversed.doTest(prop.value, dram, ledsList); break; case TestProp::Type::Random: result = testRandom.doTest(millis(), dram, ledsList); break; } if (result == cTest::Result::OK) { CurrentTestIndex++; const uint32_t totalTests = sizeof(TestsList) / sizeof(TestsList[0]); Serial.println(" => " + String(100.0f * CurrentTestIndex / totalTests, 1) + "%"); if (CurrentTestIndex == totalTests) { CurrentState = State::Idle; ledsList.showGreen(); showGoodRamMessage(); } } else { CurrentState = State::Idle; ledsList.showRed(); showBadRamMessage(); } } else { if (btnStart.update()) { if (CurrentState == State::Idle) { CurrentState = State::Testing; CurrentTestIndex = 0; ledsList.showIdle(); } } _delay_us(100); } } return 0; }
26.651282
98
0.433712
true
1,102
16e01af2e8d237f33cd978e69575072256683e2a
903
ino
Arduino
PCRaven's/LineSensorExample/LineSensorExample.ino
GOTLTL/zumo_32u4_examples
6b507f5d5c04dcddb7b5e8ef7584bacd2fa65267
[ "MIT" ]
18
2016-11-29T17:41:42.000Z
2022-03-21T18:28:27.000Z
PCRaven's/LineSensorExample/LineSensorExample.ino
GOTLTL/zumo_32u4_examples
6b507f5d5c04dcddb7b5e8ef7584bacd2fa65267
[ "MIT" ]
null
null
null
PCRaven's/LineSensorExample/LineSensorExample.ino
GOTLTL/zumo_32u4_examples
6b507f5d5c04dcddb7b5e8ef7584bacd2fa65267
[ "MIT" ]
12
2017-09-27T20:52:28.000Z
2022-03-29T15:44:14.000Z
// Line Sensor Example #include <Zumo32U4.h> // LCD Screen Zumo32U4LCD lcd; // Line sensors. Documentation: // http://pololu.github.io/zumo-32u4-arduino-library/class_zumo32_u4_line_sensors.html Zumo32U4LineSensors lineSensors; // Sensor values will go in this array unsigned int lineSensorValues[3]; void setup() { // Initialize the sensors, and turn on the LEDs for them. lineSensors.initThreeSensors(); lineSensors.emittersOn(); } void loop() { // Read in the values lineSensors.read(lineSensorValues); // Display the values. // Divide by 10 because our screen isn't large. // First value lcd.gotoXY(0, 0); lcd.print(lineSensorValues[0] / 10); lcd.print(" "); // Second value lcd.gotoXY(5, 0); lcd.print(lineSensorValues[1] / 10); lcd.print(" "); // Third value lcd.gotoXY(0, 1); lcd.print(lineSensorValues[2] / 10); lcd.print(" "); delay(250); }
20.522727
86
0.687708
true
272
de1c8b88c9564fc4022f34374d151d661007150a
436
ino
Arduino
Sunfounder/Lesson 22 Buzzer/code/Active/Active.ino
jj9146/Arduino
bfee6d42067b342eb51cbe42bb3c2020f9c9c858
[ "MIT" ]
null
null
null
Sunfounder/Lesson 22 Buzzer/code/Active/Active.ino
jj9146/Arduino
bfee6d42067b342eb51cbe42bb3c2020f9c9c858
[ "MIT" ]
null
null
null
Sunfounder/Lesson 22 Buzzer/code/Active/Active.ino
jj9146/Arduino
bfee6d42067b342eb51cbe42bb3c2020f9c9c858
[ "MIT" ]
0
null
null
/************************************************ * function:you can hear the active buzzer beeping. * But it won't work if you use a passive one here. *************************************************/ int buzzerPin = 7;//the pin of the active buzzer attach to pin7 void setup() { pinMode(buzzerPin,OUTPUT);//set the buzzer as as OUTPUT digitalWrite(buzzerPin,LOW);//initialize the buzzerPin as LOW level } void loop() { }
25.647059
69
0.552752
true
97
4f579b989554a5b52178befd8f36d99f6e37be4f
890
ino
Arduino
code/code.ino
bocasfx/midi-drum-controller
ab20326987a75b234ed3a16226d09f1421dfe3db
[ "MIT" ]
null
null
null
code/code.ino
bocasfx/midi-drum-controller
ab20326987a75b234ed3a16226d09f1421dfe3db
[ "MIT" ]
null
null
null
code/code.ino
bocasfx/midi-drum-controller
ab20326987a75b234ed3a16226d09f1421dfe3db
[ "MIT" ]
0
null
null
const int velocity = 100; // Default velocity. const int noteON = 144; // 144 = 10010000 in binary, note on command. const int noteOFF = 128; // 128 = 10000000 in binary, note off command. const int padCount = 10; // Number of pads. const int piezoThreshold = 5; // Analog threshold for piezo sensing. const int noteDelay = 100; // Default note delay. void setup() { Serial.begin(115200); } void loop() { //from note 50 (D3) to note 69 (A4) for (int pad=0; pad<padCount; pad++) { int value = analogRead(pad); if (value > piezoThreshold) { MIDImessage(noteON, pad, velocity); delay(noteDelay); MIDImessage(noteOFF, pad, velocity); } } } //send MIDI message void MIDImessage(int command, int MIDInote, int MIDIvelocity) { Serial.write(command); Serial.write(MIDInote); Serial.write(MIDIvelocity); }
25.428571
78
0.642697
true
252
391832339c7faf2b4708ea1cd6f9d7b01715f679
4,951
ino
Arduino
Audio/GranularSynth/GranularSynth.ino
SteveAmor/LittleArduinoProjects
19644961a87f3ae2e73159c2e69dfe07fe2335bf
[ "MIT" ]
1
2020-12-27T17:38:55.000Z
2020-12-27T17:38:55.000Z
Audio/GranularSynth/GranularSynth.ino
slimem8mile/LittleArduinoProjects
05329499d4a7e6fc403bc5c71a5efa024b57f58e
[ "MIT" ]
null
null
null
Audio/GranularSynth/GranularSynth.ino
slimem8mile/LittleArduinoProjects
05329499d4a7e6fc403bc5c71a5efa024b57f58e
[ "MIT" ]
0
null
null
/* GranularSynth For info and circuit diagrams see https://github.com/tardate/LittleArduinoProjects/tree/master/Audio/GranularSynth Based on Auduino, the Lo-Fi granular synthesiser by Peter Knight, Tinker.it http://tinker.it http://code.google.com/p/tinkerit/wiki/Auduino */ uint16_t syncPhaseAcc; uint16_t syncPhaseInc; uint16_t grainPhaseAcc; uint16_t grainPhaseInc; uint16_t grainAmp; uint8_t grainDecay; uint16_t grain2PhaseAcc; uint16_t grain2PhaseInc; uint16_t grain2Amp; uint8_t grain2Decay; // Map Analogue input channels #define GRAIN1_FREQ_CONTROL (0) #define GRAIN1_DECAY_CONTROL (1) #define GRAIN2_DECAY_CONTROL (2) #define GRAIN2_FREQ_CONTROL (3) #define SYNC_CONTROL (4) // PWM output, constants for direct register manipulation #define PWM_PIN 3 #define PWM_VALUE OCR2B #define PWM_INTERRUPT TIMER2_OVF_vect // LED on pin 13, constants for direct port manipulation #define LED_PIN 13 #define LED_PORT PORTB #define LED_BIT 5 // Smooth logarithmic mapping // uint16_t antilogTable[] = { 64830,64132,63441,62757,62081,61413,60751,60097,59449,58809,58176,57549,56929,56316,55709,55109, 54515,53928,53347,52773,52204,51642,51085,50535,49991,49452,48920,48393,47871,47356,46846,46341, 45842,45348,44859,44376,43898,43425,42958,42495,42037,41584,41136,40693,40255,39821,39392,38968, 38548,38133,37722,37316,36914,36516,36123,35734,35349,34968,34591,34219,33850,33486,33125,32768 }; uint16_t mapPhaseInc(uint16_t input) { return (antilogTable[input & 0x3f]) >> (input >> 6); } // Stepped chromatic mapping // uint16_t midiTable[] = { 17,18,19,20,22,23,24,26,27,29,31,32,34,36,38,41,43,46,48,51,54,58,61,65,69,73, 77,82,86,92,97,103,109,115,122,129,137,145,154,163,173,183,194,206,218,231, 244,259,274,291,308,326,346,366,388,411,435,461,489,518,549,581,616,652,691, 732,776,822,871,923,978,1036,1097,1163,1232,1305,1383,1465,1552,1644,1742, 1845,1955,2071,2195,2325,2463,2610,2765,2930,3104,3288,3484,3691,3910,4143, 4389,4650,4927,5220,5530,5859,6207,6577,6968,7382,7821,8286,8779,9301,9854, 10440,11060,11718,12415,13153,13935,14764,15642,16572,17557,18601,19708,20879, 22121,23436,24830,26306 }; uint16_t mapMidi(uint16_t input) { return (midiTable[(1023-input) >> 3]); } // Stepped Pentatonic mapping // uint16_t pentatonicTable[54] = { 0,19,22,26,29,32,38,43,51,58,65,77,86,103,115,129,154,173,206,231,259,308,346, 411,461,518,616,691,822,923,1036,1232,1383,1644,1845,2071,2463,2765,3288, 3691,4143,4927,5530,6577,7382,8286,9854,11060,13153,14764,16572,19708,22121,26306 }; uint16_t mapPentatonic(uint16_t input) { uint8_t value = (1023-input) / (1024/53); return (pentatonicTable[value]); } void audioOn() { // Set up PWM to 31.25kHz, phase accurate TCCR2A = _BV(COM2B1) | _BV(WGM20); TCCR2B = _BV(CS20); TIMSK2 = _BV(TOIE2); } void setup() { pinMode(PWM_PIN, OUTPUT); audioOn(); pinMode(LED_PIN, OUTPUT); } void loop() { // The loop is pretty simple - it just updates the parameters for the oscillators. // // Avoid using any functions that make extensive use of interrupts, or turn interrupts off. // They will cause clicks and poops in the audio. // Smooth frequency mapping //syncPhaseInc = mapPhaseInc(analogRead(SYNC_CONTROL)) / 4; // Stepped mapping to MIDI notes: C, Db, D, Eb, E, F... //syncPhaseInc = mapMidi(analogRead(SYNC_CONTROL)); // Stepped pentatonic mapping: D, E, G, A, B syncPhaseInc = mapPentatonic(analogRead(SYNC_CONTROL)); grainPhaseInc = mapPhaseInc(analogRead(GRAIN1_FREQ_CONTROL)) / 2; grainDecay = analogRead(GRAIN1_DECAY_CONTROL) / 8; grain2PhaseInc = mapPhaseInc(analogRead(GRAIN2_FREQ_CONTROL)) / 2; grain2Decay = analogRead(GRAIN2_DECAY_CONTROL) / 4; } SIGNAL(PWM_INTERRUPT) { uint8_t value; uint16_t output; syncPhaseAcc += syncPhaseInc; if (syncPhaseAcc < syncPhaseInc) { // Time to start the next grain grainPhaseAcc = 0; grainAmp = 0x7fff; grain2PhaseAcc = 0; grain2Amp = 0x7fff; LED_PORT ^= 1 << LED_BIT; // Faster than using digitalWrite } // Increment the phase of the grain oscillators grainPhaseAcc += grainPhaseInc; grain2PhaseAcc += grain2PhaseInc; // Convert phase into a triangle wave value = (grainPhaseAcc >> 7) & 0xff; if (grainPhaseAcc & 0x8000) value = ~value; // Multiply by current grain amplitude to get sample output = value * (grainAmp >> 8); // Repeat for second grain value = (grain2PhaseAcc >> 7) & 0xff; if (grain2PhaseAcc & 0x8000) value = ~value; output += value * (grain2Amp >> 8); // Make the grain amplitudes decay by a factor every sample (exponential decay) grainAmp -= (grainAmp >> 8) * grainDecay; grain2Amp -= (grain2Amp >> 8) * grain2Decay; // Scale output to the available range, clipping if necessary output >>= 9; if (output > 255) output = 255; // Output to PWM (this is faster than using analogWrite) PWM_VALUE = output; }
31.138365
116
0.723288
true
1,811
2b0fb81bff8e79d72aa21381e4b2c9377392f457
13,681
ino
Arduino
Gauge-Thermometer-Arduino-Due-ILI9341.ino
DrNCXCortex/Gauge-Thermometer-Arduino-Due-ILI9341
9b663166d94948a6ac1329580753958928990cba
[ "MIT", "Unlicense" ]
2
2018-03-09T06:53:38.000Z
2021-08-08T19:55:12.000Z
Gauge-Thermometer-Arduino-Due-ILI9341.ino
DrNCXCortex/Gauge-Thermometer-Arduino-Due-ILI9341
9b663166d94948a6ac1329580753958928990cba
[ "MIT", "Unlicense" ]
null
null
null
Gauge-Thermometer-Arduino-Due-ILI9341.ino
DrNCXCortex/Gauge-Thermometer-Arduino-Due-ILI9341
9b663166d94948a6ac1329580753958928990cba
[ "MIT", "Unlicense" ]
2
2016-12-21T03:29:42.000Z
2017-07-15T22:54:23.000Z
/******************************************************************************/ /* */ /* THERMOMETER GAUFE EXAMPLE FOR ARDUINO DUE */ /* */ /******************************************************************************/ /* Copyright (c) 2014 Dr. NCX (mirracle.mxx@gmail.com) */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL */ /* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED */ /* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR */ /* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES */ /* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, */ /* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS */ /* SOFTWARE. */ /* */ /* MIT license, all text above must be included in any redistribution. */ /******************************************************************************/ /*----------------------------------------------------------------------------*/ /* connection of thermistor: */ /* */ /* GND = --[ 10K ]-- A6 --[ NTC ]-- +3.3V */ /* */ /*----------------------------------------------------------------------------*/ /* ILI9341: */ /*----------------------------------------------------------------------------*/ /* 8 = RST */ /* 9 = D/C */ /* 10 = CS */ /* */ /*----------------------------------------------------------------------------*/ /* VGA: */ /*----------------------------------------------------------------------------*/ /* 41 = R --[470R]-- } */ /* 40 = R --[ 1K ]-- } = VGA 1 (RED) */ /* 39 = R --[ 2K2]-- } */ /* */ /* 38 = G --[470R]-- } */ /* 37 = G --[ 1K ]-- } = VGA 2 (GREEN) */ /* 36 = G --[ 2K2]-- } */ /* */ /* 35 = B --[390R]-- } = VGA 3 (BLUE) */ /* 34 = B --[820R]-- } */ /* */ /* 43 = Hsync --[ 82R]-- = VGA 13 */ /* 42 = Vsync --[ 82R]-- = VGA 14 */ /* */ /*----------------------------------------------------------------------------*/ #define USE_VGA // For VGA leave uncommented #define USE_ILI // For ILI9341 leave uncommented /******************************************************************************/ /* MAIN THERMISTOR VARIABLES */ /******************************************************************************/ // Thermistor pin #define THERMISTORPIN A6 // resistance at 25 degrees C #define THERMISTORNOMINAL 10000 //should be 10000ohm but +-15% tolerance // temp. for nominal resistance (almost always 25 C) #define TEMPERATURENOMINAL 25 // how many samples to take and average #define NUMSAMPLES 10 // The beta coefficient of the thermistor (usually 3000-4000) [B25/50 value] #define BCOEFFICIENT 4050 // the value of the 'other' resistor //should be 10000ohm #define SERIESRESISTOR 10000 /******************************************************************************/ /* LIBRARIES INCLUDES */ /******************************************************************************/ #include "sprites.h" // INCLUDEs bitmaps // SPI Library #include <SPI.h> #ifdef USE_VGA // VGA library by stimmer, v0.404 (4/4/2013) http://stimmer.github.io/DueVGA/ #include "VGA.h" #endif #ifdef USE_ILI // ILI9341_due NEW lib by Marek Buriak http://marekburiak.github.io/ILI9341_due/ #include "ILI9341_due_config.h" #include "ILI9341_due.h" // Connection konfiguration of ILI9341 LCD TFT #define TFT_RST 8 #define TFT_DC 9 #define TFT_CS 10 ILI9341_due tft = ILI9341_due(TFT_CS, TFT_DC, TFT_RST); #endif #define BLACK 0x0000 /******************************************************************************/ /* MEASURE TEMPERATURE */ /******************************************************************************/ // measure temperature float getTemperature(void){ int i; float average; int samples[NUMSAMPLES]; float thermistorResistance; // acquire N samples for (i=0; i< NUMSAMPLES; i++) { samples[i] = analogRead(THERMISTORPIN); delay(10); } // average all the samples out average = 0; for (i=0; i< NUMSAMPLES; i++) { average += samples[i]; } average /= NUMSAMPLES; // convert the value to resistance thermistorResistance = average * SERIESRESISTOR / (1023 - average); float steinhart; steinhart = thermistorResistance / THERMISTORNOMINAL; // (R/Ro) steinhart = log(steinhart); // ln(R/Ro) steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro) steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To) steinhart = 1.0 / steinhart; // Invert steinhart -= 273.15; // convert to C // float value return(steinhart); } /******************************************************************************/ /* GRRAPHICS FUNCTIONS */ /******************************************************************************/ void VGAdrawBitmap2bpp (const unsigned char* bitmap, const unsigned char* pal, word x, word y, word w, word h) { uint32_t i=0; for (word tmpy=0;tmpy<h;tmpy++) { for (word tmpx=0;tmpx<w;tmpx++) { VGA.drawPixel(x+tmpx, y+tmpy, pal[(unsigned char)bitmap[i] & 0x03 ]); tmpx++; VGA.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0x0c) >> 2) ]); tmpx++; VGA.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0x30) >> 4) ]); tmpx++; VGA.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0xc0) >> 6) ]); i++; } } } void tftdrawBitmap2bpp (const unsigned char* bitmap, const word* pal, word x, word y, word w, word h) { uint32_t i=0; for (word tmpy=0;tmpy<h;tmpy++) { for (word tmpx=0;tmpx<w;tmpx++) { tft.drawPixel(x+tmpx, y+tmpy, pal[(unsigned char)bitmap[i] & 0x03 ]); tmpx++; tft.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0x0c) >> 2) ]); tmpx++; tft.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0x30) >> 4) ]); tmpx++; tft.drawPixel(x+tmpx, y+tmpy, pal[((((unsigned char)bitmap[i]) & 0xc0) >> 6) ]); i++; } } } void tftRedrawBitmapSector2bpp (int x0,int y0,int x1,int y1,const unsigned char* bitmap, const word* pal, int x,int y, word w, word h) { uint32_t i=0; if (x1<x0) { word _x_=x0; x1=x0; x0=_x_; } if (y1<y0) { word _y_=y0; y1=y0; y0=_y_; } if (x0<x) x0=x; if (y0<y) y0=x; if (x1<x) return; if (y1<y) return; for (word tmpy=y0-2;tmpy<y1+1;tmpy++) { for (word tmpx=x0/4-1;tmpx<x1/4+1;tmpx++) { tft.drawPixel(tmpx*4+0+x%4, y+tmpy, pal[(unsigned char)bitmap[(tmpx-x/4)+tmpy*(w/4)] & 0x03 ]); tft.drawPixel(tmpx*4+1+x%4, y+tmpy, pal[((((unsigned char)bitmap[(tmpx-x/4)+tmpy*(w/4)]) & 0x0c) >> 2) ]); tft.drawPixel(tmpx*4+2+x%4, y+tmpy, pal[((((unsigned char)bitmap[(tmpx-x/4)+tmpy*(w/4)]) & 0x30) >> 4) ]); tft.drawPixel(tmpx*4+3+x%4, y+tmpy, pal[((((unsigned char)bitmap[(tmpx-x/4)+tmpy*(w/4)]) & 0xc0) >> 6) ]); } } } /******************************************************************************/ /* GAUGE DRAW FUNCTIONS */ /******************************************************************************/ void tftGaugeClearNeedle (word x0, word y0, word r, word r0, float ddeg, boolean line=true) { float drad = ddeg * 2.0f * 3.142f / 360.0f; float x1 = x0 + r * cosf(drad); float y1 = y0 + r * sinf(drad); float x2 = x0 + r0 * cosf(drad-90); float y2 = y0 + r0 * sinf(drad-90); float x3 = x0 + r0 * cosf(drad+90); float y3 = y0 + r0 * sinf(drad+90); word tminX=0; word tminY=0; word tmaxX=0; word tmaxY=0; if (x1<x2 && x1<x3) tminX=x1; else if (x2<x1 && x2<x3) tminX=x2; else if (x3<x1 && x3<x2) tminX=x3; if (x1>x2 && x1>x3) tmaxX=x1; else if (x2>x1 && x2>x3) tmaxX=x2; else if (x3>x1 && x3>x2) tmaxX=x3; if (y1<y2 && y1<y3) tminY=y1; else if (y2<y1 && y2<y3) tminY=y2; else if (y3<y1 && y3<y2) tminY=y3; if (y1>y2 && y1>y3) tmaxY=y1; else if (y2>y1 && y2>y3) tmaxY=y2; else if (y3>y1 && y3>y2) tmaxY=y3; tftRedrawBitmapSector2bpp (tminX,tminY-r0,tmaxX,tmaxY,gauge, gauge_pal0,50,10,220,220); } void tftGaugeDrawNeedle (word x0, word y0, word r, word r0, float ddeg, boolean line=true) { float drad = ddeg * 2.0f * 3.142f / 360.0f; float x1 = x0 + r * cosf(drad); float y1 = y0 + r * sinf(drad); float x2 = x0 + r0 * cosf(drad-90); float y2 = y0 + r0 * sinf(drad-90); float x3 = x0 + r0 * cosf(drad+90); float y3 = y0 + r0 * sinf(drad+90); if (line==true) { tft.drawLine(x0, y0, x1, y1, C16(255,0,0)); } else { tft.fillTriangle( x1, y1, x2, y2, x3, y3,C16(255,0,0)); tft.drawLine(x2, y2, x1, y1, C16(0,0,0)); tft.drawLine(x3, y3, x1, y1, C16(0,0,0)); tft.fillCircle(x0, y0, r0, C16(255,0,0)); tft.drawCircle(x0, y0, r0, C16(0,0,0)); } } void VGAGaugeDrawNeedle (word x0, word y0, word r, word r0, float ddeg, boolean line=true) { float drad = ddeg * 2.0f * 3.142f / 360.0f; float x1 = x0 + r * cosf(drad); float y1 = y0 + r * sinf(drad); float x2 = x0 + r0 * cosf(drad-90); float y2 = y0 + r0 * sinf(drad-90); float x3 = x0 + r0 * cosf(drad+90); float y3 = y0 + r0 * sinf(drad+90); if (line==true) { VGA.drawLine(x0, y0, x1, y1, C8(255,0,0)); } else { VGA.fillTri( x1, y1, x2, y2, x3, y3,C8(255,0,0)); VGA.drawLine(x2, y2, x1, y1, C8(0,0,0)); VGA.drawLine(x3, y3, x1, y1, C8(0,0,0)); VGA.fillCircle(x0, y0, r0, C8(255,0,0)); VGA.drawCircle(x0, y0, r0, C8(0,0,0)); } } /******************************************************************************/ /* SETUP */ /******************************************************************************/ void setup() { Serial.begin(9600); //------------------------------------------------------------------------------ #ifdef USE_VGA // SETUP VGA OUTPUT VGA.begin(320,240,VGA_COLOUR); #endif //------------------------------------------------------------------------------ #ifdef USE_ILI // SETUP TFT LCD tft.begin(); delay(100); tft.setRotation(iliRotation270); delay(100); tft.fillScreen(BLACK); #endif //------------------------------------------------------------------------------ tftdrawBitmap2bpp(gauge, gauge_pal0,50,10,220,220); VGAdrawBitmap2bpp(gauge,gauge_pal1,50,10,220,220); } /******************************************************************************/ /* LOOP */ /******************************************************************************/ float actVal = 0; //actual temperature float stepVal = 0; //actual temperature step float prevVal = 0; //previous value of step temperature float points = 0; float prevpoints = 0; void AnimateGaugeNeedle(float tempVal) { prevVal=stepVal; if (stepVal>tempVal-2 && stepVal<tempVal+2 ){ stepVal=tempVal; } else if (stepVal>tempVal) { for (byte i=3;i>0;i--) { if (stepVal>tempVal) stepVal--; } } else if (stepVal<tempVal) { for (byte i=3;i>0;i--) { if (stepVal<tempVal) stepVal++; } } prevpoints = (((prevVal + 10) /80) * 268) + 137; if (prevpoints>=360) prevpoints=prevpoints-360; points = (((stepVal + 10) /80) * 268) + 137; if (points>=360) points=points-360; tftGaugeClearNeedle(160, 120, 85, 8, prevpoints, false); VGAdrawBitmap2bpp(gauge,gauge_pal1,50,10,220,220); VGAGaugeDrawNeedle (160, 120, 85, 8, points, false); tftGaugeDrawNeedle (160, 120, 85, 8, points, false); } void loop() { actVal = getTemperature(); Serial.println(actVal); AnimateGaugeNeedle(actVal); delay(1000); }
38.322129
136
0.41459
true
3,704
13735b6c346c567c4d96b1af422007311b0ddd12
555
ino
Arduino
lessons/4_PID/pid_balancing_seesaw/setup_loop.ino
hazardemircan/ArduinoQuadcopterFlightController
bf4beedf39377397738d376c89eb07c263618ff4
[ "MIT" ]
3
2021-05-30T18:17:04.000Z
2022-01-29T17:07:54.000Z
lessons/4_PID/pid_balancing_seesaw/setup_loop.ino
hazardemircan/ArduinoQuadcopterFlightController
bf4beedf39377397738d376c89eb07c263618ff4
[ "MIT" ]
null
null
null
lessons/4_PID/pid_balancing_seesaw/setup_loop.ino
hazardemircan/ArduinoQuadcopterFlightController
bf4beedf39377397738d376c89eb07c263618ff4
[ "MIT" ]
18
2021-02-10T11:46:57.000Z
2022-03-27T07:46:07.000Z
void setup() { initializeMotor(); initializeReceiver(); initializeIMU(); Serial.begin(115200); } void loop() { struct ReceiverCommands receiverCommands = GetReceiverCommands(); struct IMU_Values imuValues = GetIMU_Values(); if(receiverCommands.Error || imuValues.Error || receiverCommands.Throttle < 20){ stopMotors(); resetPidVariables(); return; } if(imuValues.NewDataAvailable == false){ return; } struct MotorPowers motorPowers = calculateMotorPowers(receiverCommands, imuValues); spinMotors(motorPowers); }
23.125
85
0.726126
true
134
4dce4c82f3a66fb0a0629858db78f3f0ec64a489
19,539
ino
Arduino
banana_segman/banana_segman.ino
rahul-madaan/Texas_instruments_Launchpad_LCD
cdead61b57b0feaf1be05b18178cb7449ea7a21f
[ "MIT" ]
null
null
null
banana_segman/banana_segman.ino
rahul-madaan/Texas_instruments_Launchpad_LCD
cdead61b57b0feaf1be05b18178cb7449ea7a21f
[ "MIT" ]
1
2021-05-19T09:14:47.000Z
2021-05-19T09:14:47.000Z
banana_segman/banana_segman.ino
rahul-madaan/Texas_instruments_Launchpad_LCD
cdead61b57b0feaf1be05b18178cb7449ea7a21f
[ "MIT" ]
0
null
null
// // Sharp128 BoosterPackLCD SPI // Example for library for Sharp BoosterPack LCD with hardware SPI // // // Author : Stefan Schauer // Date : Oct. 17, 2017 // Version: 1.00 // File : LCD_Sharp128BoosterPack_SPI_main.ino // // Version: 1.00 : setup for Sharp128 Booster pack based on Sharp96 example // // Based on the LCD5110 Library // Created by Rei VILO on 28/05/12 // Copyright (c) 2012 http://embeddedcomputing.weebly.com // Licence CC = BY SA NC // // Edited 2015-07-11 by ReiVilo // Added setOrientation(), setReverse() and flushReverse() // // Include application, user and local libraries #include "SPI.h" #include "OneMsTaskTimer.h" #include "LCD_SharpBoosterPack_SPI.h" // Variables LCD_SharpBoosterPack_SPI myScreen(SHARP_128); uint8_t myOrientation = 0; uint16_t myCount = 0; #define LCD_VERTICAL_MAX myScreen.getSize() #define LCD_HORIZONTAL_MAX myScreen.getSize() // Add setup code void setup() { Serial.begin(9600); myScreen.begin(); myScreen.clearBuffer(); } // Add loop code void loop() { myScreen.clearBuffer(); myScreen.setFont(1); myScreen.setCharXY(5, 3); myScreen.print("BananaPeel"); for (uint8_t i = 10; i < LCD_HORIZONTAL_MAX - 10; i++) { myScreen.setXY(i, 23, 1); } for (uint8_t i = 0; i <= 50; i++) { myScreen.setXY(10 + i, 30, 1); // } // for (uint8_t i=0; i<=20; i++) { myScreen.setXY(10, 30 + i, 1); // } // for (uint8_t i=0; i<=20; i++) { myScreen.setXY(10 + i, 80, 1); // } // for (uint8_t i=0; i<=20; i++) { myScreen.setXY(60, 30 + i, 1); } myScreen.setXY( 12 , 66 ,1); myScreen.setXY( 13 , 64 ,1); myScreen.setXY( 13 , 65 ,1); myScreen.setXY( 13 , 66 ,1); myScreen.setXY( 13 , 67 ,1); myScreen.setXY( 13 , 68 ,1); myScreen.setXY( 14 , 64 ,1); myScreen.setXY( 14 , 65 ,1); myScreen.setXY( 14 , 66 ,1); myScreen.setXY( 14 , 67 ,1); myScreen.setXY( 14 , 68 ,1); myScreen.setXY( 14 , 69 ,1); myScreen.setXY( 14 , 70 ,1); myScreen.setXY( 15 , 64 ,1); myScreen.setXY( 15 , 65 ,1); myScreen.setXY( 15 , 66 ,1); myScreen.setXY( 15 , 67 ,1); myScreen.setXY( 15 , 68 ,1); myScreen.setXY( 15 , 69 ,1); myScreen.setXY( 15 , 70 ,1); myScreen.setXY( 15 , 71 ,1); myScreen.setXY( 16 , 64 ,1); myScreen.setXY( 16 , 65 ,1); myScreen.setXY( 16 , 66 ,1); myScreen.setXY( 16 , 67 ,1); myScreen.setXY( 16 , 68 ,1); myScreen.setXY( 16 , 69 ,1); myScreen.setXY( 16 , 70 ,1); myScreen.setXY( 16 , 71 ,1); myScreen.setXY( 16 , 72 ,1); myScreen.setXY( 17 , 65 ,1); myScreen.setXY( 17 , 66 ,1); myScreen.setXY( 17 , 67 ,1); myScreen.setXY( 17 , 68 ,1); myScreen.setXY( 17 , 70 ,1); myScreen.setXY( 17 , 71 ,1); myScreen.setXY( 17 , 72 ,1); myScreen.setXY( 18 , 66 ,1); myScreen.setXY( 18 , 67 ,1); myScreen.setXY( 18 , 68 ,1); myScreen.setXY( 18 , 69 ,1); myScreen.setXY( 18 , 70 ,1); myScreen.setXY( 18 , 71 ,1); myScreen.setXY( 18 , 72 ,1); myScreen.setXY( 18 , 73 ,1); myScreen.setXY( 19 , 67 ,1); myScreen.setXY( 19 , 68 ,1); myScreen.setXY( 19 , 69 ,1); myScreen.setXY( 19 , 71 ,1); myScreen.setXY( 19 , 72 ,1); myScreen.setXY( 19 , 73 ,1); myScreen.setXY( 20 , 67 ,1); myScreen.setXY( 20 , 68 ,1); myScreen.setXY( 20 , 69 ,1); myScreen.setXY( 20 , 71 ,1); myScreen.setXY( 20 , 72 ,1); myScreen.setXY( 20 , 73 ,1); myScreen.setXY( 21 , 67 ,1); myScreen.setXY( 21 , 68 ,1); myScreen.setXY( 21 , 69 ,1); myScreen.setXY( 21 , 72 ,1); myScreen.setXY( 21 , 73 ,1); myScreen.setXY( 21 , 74 ,1); myScreen.setXY( 22 , 67 ,1); myScreen.setXY( 22 , 68 ,1); myScreen.setXY( 22 , 69 ,1); myScreen.setXY( 22 , 72 ,1); myScreen.setXY( 22 , 73 ,1); myScreen.setXY( 22 , 74 ,1); myScreen.setXY( 23 , 67 ,1); myScreen.setXY( 23 , 68 ,1); myScreen.setXY( 23 , 69 ,1); myScreen.setXY( 23 , 72 ,1); myScreen.setXY( 23 , 73 ,1); myScreen.setXY( 23 , 74 ,1); myScreen.setXY( 24 , 67 ,1); myScreen.setXY( 24 , 68 ,1); myScreen.setXY( 24 , 69 ,1); myScreen.setXY( 24 , 72 ,1); myScreen.setXY( 24 , 73 ,1); myScreen.setXY( 24 , 74 ,1); myScreen.setXY( 25 , 67 ,1); myScreen.setXY( 25 , 68 ,1); myScreen.setXY( 25 , 69 ,1); myScreen.setXY( 25 , 72 ,1); myScreen.setXY( 25 , 73 ,1); myScreen.setXY( 25 , 74 ,1); myScreen.setXY( 26 , 67 ,1); myScreen.setXY( 26 , 68 ,1); myScreen.setXY( 26 , 69 ,1); myScreen.setXY( 26 , 72 ,1); myScreen.setXY( 26 , 73 ,1); myScreen.setXY( 26 , 74 ,1); myScreen.setXY( 27 , 66 ,1); myScreen.setXY( 27 , 67 ,1); myScreen.setXY( 27 , 68 ,1); myScreen.setXY( 27 , 72 ,1); myScreen.setXY( 27 , 73 ,1); myScreen.setXY( 27 , 74 ,1); myScreen.setXY( 28 , 65 ,1); myScreen.setXY( 28 , 66 ,1); myScreen.setXY( 28 , 67 ,1); myScreen.setXY( 28 , 68 ,1); myScreen.setXY( 28 , 72 ,1); myScreen.setXY( 28 , 73 ,1); myScreen.setXY( 28 , 74 ,1); myScreen.setXY( 29 , 64 ,1); myScreen.setXY( 29 , 65 ,1); myScreen.setXY( 29 , 66 ,1); myScreen.setXY( 29 , 67 ,1); myScreen.setXY( 29 , 68 ,1); myScreen.setXY( 29 , 72 ,1); myScreen.setXY( 29 , 73 ,1); myScreen.setXY( 29 , 74 ,1); myScreen.setXY( 30 , 62 ,1); myScreen.setXY( 30 , 63 ,1); myScreen.setXY( 30 , 64 ,1); myScreen.setXY( 30 , 65 ,1); myScreen.setXY( 30 , 66 ,1); myScreen.setXY( 30 , 67 ,1); myScreen.setXY( 30 , 72 ,1); myScreen.setXY( 30 , 73 ,1); myScreen.setXY( 31 , 50 ,1); myScreen.setXY( 31 , 51 ,1); myScreen.setXY( 31 , 52 ,1); myScreen.setXY( 31 , 53 ,1); myScreen.setXY( 31 , 54 ,1); myScreen.setXY( 31 , 55 ,1); myScreen.setXY( 31 , 56 ,1); myScreen.setXY( 31 , 57 ,1); myScreen.setXY( 31 , 58 ,1); myScreen.setXY( 31 , 59 ,1); myScreen.setXY( 31 , 60 ,1); myScreen.setXY( 31 , 61 ,1); myScreen.setXY( 31 , 62 ,1); myScreen.setXY( 31 , 63 ,1); myScreen.setXY( 31 , 64 ,1); myScreen.setXY( 31 , 65 ,1); myScreen.setXY( 31 , 71 ,1); myScreen.setXY( 31 , 72 ,1); myScreen.setXY( 31 , 73 ,1); myScreen.setXY( 32 , 46 ,1); myScreen.setXY( 32 , 47 ,1); myScreen.setXY( 32 , 48 ,1); myScreen.setXY( 32 , 49 ,1); myScreen.setXY( 32 , 50 ,1); myScreen.setXY( 32 , 51 ,1); myScreen.setXY( 32 , 52 ,1); myScreen.setXY( 32 , 53 ,1); myScreen.setXY( 32 , 54 ,1); myScreen.setXY( 32 , 55 ,1); myScreen.setXY( 32 , 56 ,1); myScreen.setXY( 32 , 57 ,1); myScreen.setXY( 32 , 58 ,1); myScreen.setXY( 32 , 59 ,1); myScreen.setXY( 32 , 60 ,1); myScreen.setXY( 32 , 61 ,1); myScreen.setXY( 32 , 62 ,1); myScreen.setXY( 32 , 63 ,1); myScreen.setXY( 32 , 71 ,1); myScreen.setXY( 32 , 72 ,1); myScreen.setXY( 32 , 73 ,1); myScreen.setXY( 33 , 43 ,1); myScreen.setXY( 33 , 44 ,1); myScreen.setXY( 33 , 45 ,1); myScreen.setXY( 33 , 46 ,1); myScreen.setXY( 33 , 47 ,1); myScreen.setXY( 33 , 48 ,1); myScreen.setXY( 33 , 49 ,1); myScreen.setXY( 33 , 50 ,1); myScreen.setXY( 33 , 51 ,1); myScreen.setXY( 33 , 52 ,1); myScreen.setXY( 33 , 53 ,1); myScreen.setXY( 33 , 54 ,1); myScreen.setXY( 33 , 55 ,1); myScreen.setXY( 33 , 56 ,1); myScreen.setXY( 33 , 57 ,1); myScreen.setXY( 33 , 58 ,1); myScreen.setXY( 33 , 59 ,1); myScreen.setXY( 33 , 60 ,1); myScreen.setXY( 33 , 61 ,1); myScreen.setXY( 33 , 70 ,1); myScreen.setXY( 33 , 71 ,1); myScreen.setXY( 33 , 72 ,1); myScreen.setXY( 34 , 41 ,1); myScreen.setXY( 34 , 42 ,1); myScreen.setXY( 34 , 43 ,1); myScreen.setXY( 34 , 44 ,1); myScreen.setXY( 34 , 45 ,1); myScreen.setXY( 34 , 46 ,1); myScreen.setXY( 34 , 47 ,1); myScreen.setXY( 34 , 48 ,1); myScreen.setXY( 34 , 49 ,1); myScreen.setXY( 34 , 70 ,1); myScreen.setXY( 34 , 71 ,1); myScreen.setXY( 34 , 72 ,1); myScreen.setXY( 35 , 33 ,1); myScreen.setXY( 35 , 34 ,1); myScreen.setXY( 35 , 35 ,1); myScreen.setXY( 35 , 36 ,1); myScreen.setXY( 35 , 37 ,1); myScreen.setXY( 35 , 38 ,1); myScreen.setXY( 35 , 39 ,1); myScreen.setXY( 35 , 40 ,1); myScreen.setXY( 35 , 41 ,1); myScreen.setXY( 35 , 42 ,1); myScreen.setXY( 35 , 43 ,1); myScreen.setXY( 35 , 44 ,1); myScreen.setXY( 35 , 45 ,1); myScreen.setXY( 35 , 52 ,1); myScreen.setXY( 35 , 53 ,1); myScreen.setXY( 35 , 54 ,1); myScreen.setXY( 35 , 55 ,1); myScreen.setXY( 35 , 56 ,1); myScreen.setXY( 35 , 57 ,1); myScreen.setXY( 35 , 58 ,1); myScreen.setXY( 35 , 59 ,1); myScreen.setXY( 35 , 60 ,1); myScreen.setXY( 35 , 61 ,1); myScreen.setXY( 35 , 62 ,1); myScreen.setXY( 35 , 63 ,1); myScreen.setXY( 35 , 64 ,1); myScreen.setXY( 35 , 65 ,1); myScreen.setXY( 35 , 66 ,1); myScreen.setXY( 35 , 69 ,1); myScreen.setXY( 35 , 70 ,1); myScreen.setXY( 35 , 71 ,1); myScreen.setXY( 36 , 33 ,1); myScreen.setXY( 36 , 34 ,1); myScreen.setXY( 36 , 35 ,1); myScreen.setXY( 36 , 36 ,1); myScreen.setXY( 36 , 37 ,1); myScreen.setXY( 36 , 38 ,1); myScreen.setXY( 36 , 39 ,1); myScreen.setXY( 36 , 40 ,1); myScreen.setXY( 36 , 41 ,1); myScreen.setXY( 36 , 42 ,1); myScreen.setXY( 36 , 43 ,1); myScreen.setXY( 36 , 52 ,1); myScreen.setXY( 36 , 53 ,1); myScreen.setXY( 36 , 54 ,1); myScreen.setXY( 36 , 55 ,1); myScreen.setXY( 36 , 56 ,1); myScreen.setXY( 36 , 57 ,1); myScreen.setXY( 36 , 58 ,1); myScreen.setXY( 36 , 59 ,1); myScreen.setXY( 36 , 60 ,1); myScreen.setXY( 36 , 61 ,1); myScreen.setXY( 36 , 62 ,1); myScreen.setXY( 36 , 63 ,1); myScreen.setXY( 36 , 64 ,1); myScreen.setXY( 36 , 65 ,1); myScreen.setXY( 36 , 66 ,1); myScreen.setXY( 36 , 67 ,1); myScreen.setXY( 36 , 68 ,1); myScreen.setXY( 36 , 69 ,1); myScreen.setXY( 36 , 70 ,1); myScreen.setXY( 37 , 33 ,1); myScreen.setXY( 37 , 34 ,1); myScreen.setXY( 37 , 35 ,1); myScreen.setXY( 37 , 36 ,1); myScreen.setXY( 37 , 37 ,1); myScreen.setXY( 37 , 38 ,1); myScreen.setXY( 37 , 39 ,1); myScreen.setXY( 37 , 40 ,1); myScreen.setXY( 37 , 63 ,1); myScreen.setXY( 37 , 64 ,1); myScreen.setXY( 37 , 65 ,1); myScreen.setXY( 37 , 66 ,1); myScreen.setXY( 37 , 67 ,1); myScreen.setXY( 37 , 68 ,1); myScreen.setXY( 37 , 69 ,1); myScreen.setXY( 37 , 70 ,1); myScreen.setXY( 37 , 71 ,1); myScreen.setXY( 37 , 72 ,1); myScreen.setXY( 38 , 33 ,1); myScreen.setXY( 38 , 34 ,1); myScreen.setXY( 38 , 35 ,1); myScreen.setXY( 38 , 36 ,1); myScreen.setXY( 38 , 37 ,1); myScreen.setXY( 38 , 38 ,1); myScreen.setXY( 38 , 39 ,1); myScreen.setXY( 38 , 40 ,1); myScreen.setXY( 38 , 68 ,1); myScreen.setXY( 38 , 69 ,1); myScreen.setXY( 38 , 70 ,1); myScreen.setXY( 38 , 71 ,1); myScreen.setXY( 38 , 72 ,1); myScreen.setXY( 38 , 73 ,1); myScreen.setXY( 39 , 33 ,1); myScreen.setXY( 39 , 34 ,1); myScreen.setXY( 39 , 35 ,1); myScreen.setXY( 39 , 36 ,1); myScreen.setXY( 39 , 37 ,1); myScreen.setXY( 39 , 38 ,1); myScreen.setXY( 39 , 39 ,1); myScreen.setXY( 39 , 40 ,1); myScreen.setXY( 39 , 41 ,1); myScreen.setXY( 39 , 42 ,1); myScreen.setXY( 39 , 71 ,1); myScreen.setXY( 39 , 72 ,1); myScreen.setXY( 39 , 73 ,1); myScreen.setXY( 39 , 74 ,1); myScreen.setXY( 40 , 36 ,1); myScreen.setXY( 40 , 37 ,1); myScreen.setXY( 40 , 38 ,1); myScreen.setXY( 40 , 39 ,1); myScreen.setXY( 40 , 40 ,1); myScreen.setXY( 40 , 41 ,1); myScreen.setXY( 40 , 42 ,1); myScreen.setXY( 40 , 43 ,1); myScreen.setXY( 40 , 44 ,1); myScreen.setXY( 40 , 72 ,1); myScreen.setXY( 40 , 73 ,1); myScreen.setXY( 40 , 74 ,1); myScreen.setXY( 40 , 75 ,1); myScreen.setXY( 41 , 41 ,1); myScreen.setXY( 41 , 42 ,1); myScreen.setXY( 41 , 43 ,1); myScreen.setXY( 41 , 44 ,1); myScreen.setXY( 41 , 45 ,1); myScreen.setXY( 41 , 46 ,1); myScreen.setXY( 41 , 47 ,1); myScreen.setXY( 41 , 48 ,1); myScreen.setXY( 41 , 73 ,1); myScreen.setXY( 41 , 74 ,1); myScreen.setXY( 41 , 75 ,1); myScreen.setXY( 41 , 76 ,1); myScreen.setXY( 42 , 42 ,1); myScreen.setXY( 42 , 43 ,1); myScreen.setXY( 42 , 44 ,1); myScreen.setXY( 42 , 45 ,1); myScreen.setXY( 42 , 46 ,1); myScreen.setXY( 42 , 47 ,1); myScreen.setXY( 42 , 48 ,1); myScreen.setXY( 42 , 49 ,1); myScreen.setXY( 42 , 50 ,1); myScreen.setXY( 42 , 51 ,1); myScreen.setXY( 42 , 52 ,1); myScreen.setXY( 42 , 53 ,1); myScreen.setXY( 42 , 54 ,1); myScreen.setXY( 42 , 55 ,1); myScreen.setXY( 42 , 56 ,1); myScreen.setXY( 42 , 57 ,1); myScreen.setXY( 42 , 58 ,1); myScreen.setXY( 42 , 59 ,1); myScreen.setXY( 42 , 60 ,1); myScreen.setXY( 42 , 61 ,1); myScreen.setXY( 42 , 74 ,1); myScreen.setXY( 42 , 75 ,1); myScreen.setXY( 42 , 76 ,1); myScreen.setXY( 43 , 44 ,1); myScreen.setXY( 43 , 45 ,1); myScreen.setXY( 43 , 46 ,1); myScreen.setXY( 43 , 47 ,1); myScreen.setXY( 43 , 48 ,1); myScreen.setXY( 43 , 49 ,1); myScreen.setXY( 43 , 50 ,1); myScreen.setXY( 43 , 51 ,1); myScreen.setXY( 43 , 52 ,1); myScreen.setXY( 43 , 53 ,1); myScreen.setXY( 43 , 54 ,1); myScreen.setXY( 43 , 55 ,1); myScreen.setXY( 43 , 56 ,1); myScreen.setXY( 43 , 57 ,1); myScreen.setXY( 43 , 58 ,1); myScreen.setXY( 43 , 59 ,1); myScreen.setXY( 43 , 60 ,1); myScreen.setXY( 43 , 61 ,1); myScreen.setXY( 43 , 62 ,1); myScreen.setXY( 43 , 63 ,1); myScreen.setXY( 43 , 64 ,1); myScreen.setXY( 43 , 65 ,1); myScreen.setXY( 43 , 66 ,1); myScreen.setXY( 43 , 67 ,1); myScreen.setXY( 43 , 75 ,1); myScreen.setXY( 43 , 76 ,1); myScreen.setXY( 43 , 77 ,1); myScreen.setXY( 44 , 49 ,1); myScreen.setXY( 44 , 50 ,1); myScreen.setXY( 44 , 51 ,1); myScreen.setXY( 44 , 52 ,1); myScreen.setXY( 44 , 53 ,1); myScreen.setXY( 44 , 54 ,1); myScreen.setXY( 44 , 55 ,1); myScreen.setXY( 44 , 56 ,1); myScreen.setXY( 44 , 57 ,1); myScreen.setXY( 44 , 58 ,1); myScreen.setXY( 44 , 59 ,1); myScreen.setXY( 44 , 60 ,1); myScreen.setXY( 44 , 61 ,1); myScreen.setXY( 44 , 62 ,1); myScreen.setXY( 44 , 63 ,1); myScreen.setXY( 44 , 64 ,1); myScreen.setXY( 44 , 65 ,1); myScreen.setXY( 44 , 66 ,1); myScreen.setXY( 44 , 67 ,1); myScreen.setXY( 44 , 68 ,1); myScreen.setXY( 44 , 69 ,1); myScreen.setXY( 44 , 70 ,1); myScreen.setXY( 44 , 75 ,1); myScreen.setXY( 44 , 76 ,1); myScreen.setXY( 44 , 77 ,1); myScreen.setXY( 45 , 59 ,1); myScreen.setXY( 45 , 60 ,1); myScreen.setXY( 45 , 63 ,1); myScreen.setXY( 45 , 64 ,1); myScreen.setXY( 45 , 65 ,1); myScreen.setXY( 45 , 66 ,1); myScreen.setXY( 45 , 67 ,1); myScreen.setXY( 45 , 68 ,1); myScreen.setXY( 45 , 69 ,1); myScreen.setXY( 45 , 70 ,1); myScreen.setXY( 45 , 71 ,1); myScreen.setXY( 45 , 76 ,1); myScreen.setXY( 45 , 77 ,1); myScreen.setXY( 45 , 78 ,1); myScreen.setXY( 46 , 59 ,1); myScreen.setXY( 46 , 60 ,1); myScreen.setXY( 46 , 64 ,1); myScreen.setXY( 46 , 65 ,1); myScreen.setXY( 46 , 66 ,1); myScreen.setXY( 46 , 68 ,1); myScreen.setXY( 46 , 69 ,1); myScreen.setXY( 46 , 70 ,1); myScreen.setXY( 46 , 71 ,1); myScreen.setXY( 46 , 72 ,1); myScreen.setXY( 46 , 73 ,1); myScreen.setXY( 46 , 76 ,1); myScreen.setXY( 46 , 77 ,1); myScreen.setXY( 46 , 78 ,1); myScreen.setXY( 47 , 58 ,1); myScreen.setXY( 47 , 59 ,1); myScreen.setXY( 47 , 60 ,1); myScreen.setXY( 47 , 64 ,1); myScreen.setXY( 47 , 65 ,1); myScreen.setXY( 47 , 66 ,1); myScreen.setXY( 47 , 70 ,1); myScreen.setXY( 47 , 71 ,1); myScreen.setXY( 47 , 72 ,1); myScreen.setXY( 47 , 73 ,1); myScreen.setXY( 47 , 76 ,1); myScreen.setXY( 47 , 77 ,1); myScreen.setXY( 47 , 78 ,1); myScreen.setXY( 48 , 58 ,1); myScreen.setXY( 48 , 59 ,1); myScreen.setXY( 48 , 60 ,1); myScreen.setXY( 48 , 64 ,1); myScreen.setXY( 48 , 65 ,1); myScreen.setXY( 48 , 71 ,1); myScreen.setXY( 48 , 72 ,1); myScreen.setXY( 48 , 73 ,1); myScreen.setXY( 48 , 74 ,1); myScreen.setXY( 48 , 76 ,1); myScreen.setXY( 48 , 77 ,1); myScreen.setXY( 48 , 78 ,1); myScreen.setXY( 49 , 57 ,1); myScreen.setXY( 49 , 58 ,1); myScreen.setXY( 49 , 59 ,1); myScreen.setXY( 49 , 63 ,1); myScreen.setXY( 49 , 64 ,1); myScreen.setXY( 49 , 65 ,1); myScreen.setXY( 49 , 72 ,1); myScreen.setXY( 49 , 73 ,1); myScreen.setXY( 49 , 74 ,1); myScreen.setXY( 49 , 75 ,1); myScreen.setXY( 49 , 76 ,1); myScreen.setXY( 49 , 77 ,1); myScreen.setXY( 49 , 78 ,1); myScreen.setXY( 50 , 55 ,1); myScreen.setXY( 50 , 56 ,1); myScreen.setXY( 50 , 57 ,1); myScreen.setXY( 50 , 58 ,1); myScreen.setXY( 50 , 59 ,1); myScreen.setXY( 50 , 63 ,1); myScreen.setXY( 50 , 64 ,1); myScreen.setXY( 50 , 65 ,1); myScreen.setXY( 50 , 73 ,1); myScreen.setXY( 50 , 74 ,1); myScreen.setXY( 50 , 75 ,1); myScreen.setXY( 50 , 76 ,1); myScreen.setXY( 50 , 77 ,1); myScreen.setXY( 50 , 78 ,1); myScreen.setXY( 51 , 53 ,1); myScreen.setXY( 51 , 54 ,1); myScreen.setXY( 51 , 55 ,1); myScreen.setXY( 51 , 56 ,1); myScreen.setXY( 51 , 57 ,1); myScreen.setXY( 51 , 58 ,1); myScreen.setXY( 51 , 62 ,1); myScreen.setXY( 51 , 63 ,1); myScreen.setXY( 51 , 64 ,1); myScreen.setXY( 51 , 73 ,1); myScreen.setXY( 51 , 74 ,1); myScreen.setXY( 51 , 75 ,1); myScreen.setXY( 51 , 76 ,1); myScreen.setXY( 51 , 77 ,1); myScreen.setXY( 51 , 78 ,1); myScreen.setXY( 52 , 53 ,1); myScreen.setXY( 52 , 54 ,1); myScreen.setXY( 52 , 55 ,1); myScreen.setXY( 52 , 56 ,1); myScreen.setXY( 52 , 57 ,1); myScreen.setXY( 52 , 61 ,1); myScreen.setXY( 52 , 62 ,1); myScreen.setXY( 52 , 63 ,1); myScreen.setXY( 52 , 64 ,1); myScreen.setXY( 52 , 73 ,1); myScreen.setXY( 52 , 74 ,1); myScreen.setXY( 52 , 75 ,1); myScreen.setXY( 52 , 76 ,1); myScreen.setXY( 52 , 77 ,1); myScreen.setXY( 52 , 78 ,1); myScreen.setXY( 53 , 53 ,1); myScreen.setXY( 53 , 54 ,1); myScreen.setXY( 53 , 55 ,1); myScreen.setXY( 53 , 56 ,1); myScreen.setXY( 53 , 57 ,1); myScreen.setXY( 53 , 58 ,1); myScreen.setXY( 53 , 59 ,1); myScreen.setXY( 53 , 60 ,1); myScreen.setXY( 53 , 61 ,1); myScreen.setXY( 53 , 62 ,1); myScreen.setXY( 53 , 63 ,1); myScreen.setXY( 53 , 73 ,1); myScreen.setXY( 53 , 74 ,1); myScreen.setXY( 53 , 75 ,1); myScreen.setXY( 53 , 76 ,1); myScreen.setXY( 53 , 77 ,1); myScreen.setXY( 53 , 78 ,1); myScreen.setXY( 54 , 53 ,1); myScreen.setXY( 54 , 54 ,1); myScreen.setXY( 54 , 55 ,1); myScreen.setXY( 54 , 56 ,1); myScreen.setXY( 54 , 57 ,1); myScreen.setXY( 54 , 58 ,1); myScreen.setXY( 54 , 59 ,1); myScreen.setXY( 54 , 60 ,1); myScreen.setXY( 54 , 61 ,1); myScreen.setXY( 54 , 62 ,1); myScreen.setXY( 54 , 73 ,1); myScreen.setXY( 54 , 74 ,1); myScreen.setXY( 54 , 75 ,1); myScreen.setXY( 54 , 76 ,1); myScreen.setXY( 54 , 77 ,1); myScreen.setXY( 55 , 54 ,1); myScreen.setXY( 55 , 55 ,1); myScreen.setXY( 55 , 56 ,1); myScreen.setXY( 55 , 57 ,1); myScreen.setXY( 55 , 58 ,1); myScreen.setXY( 55 , 59 ,1); myScreen.setXY( 55 , 60 ,1); myScreen.setXY( 55 , 72 ,1); myScreen.setXY( 55 , 73 ,1); myScreen.setXY( 55 , 74 ,1); myScreen.setXY( 55 , 75 ,1); myScreen.setXY( 55 , 76 ,1); myScreen.setXY( 55 , 77 ,1); myScreen.setXY( 56 , 72 ,1); myScreen.setXY( 56 , 73 ,1); myScreen.setXY( 56 , 74 ,1); myScreen.setXY( 56 , 75 ,1); myScreen.setXY( 56 , 76 ,1); myScreen.setXY( 56 , 77 ,1); myScreen.setXY( 57 , 72 ,1); myScreen.setXY( 57 , 73 ,1); myScreen.setXY( 57 , 74 ,1); myScreen.setXY( 57 , 75 ,1); myScreen.setXY( 57 , 76 ,1); myScreen.setXY( 58 , 72 ,1); myScreen.setXY( 58 , 73 ,1); myScreen.setXY( 58 , 74 ,1); myScreen.setXY( 58 , 75 ,1); myScreen.setFont(0); myScreen.setCharXY(65, 34); myScreen.print("You did"); myScreen.setCharXY(65, 46); myScreen.print("something"); myScreen.setCharXY(65, 58); myScreen.print("good today"); myScreen.setCharXY(68, 72); myScreen.print("CONGRATS!"); myScreen.setFont(1); myScreen.setCharXY(47, 89); myScreen.print("NON"); myScreen.setCharXY(6, 109); myScreen.print("RECYCLABLE"); myScreen.setCharXY(10, 60); myScreen.flush(); for (uint8_t i = 0; i < 2; i++) { delay(100); } }
28.989614
78
0.597113
true
8,173
035a7e89476aac35cff8eff649de01724986b2aa
4,821
ino
Arduino
Example/Example_03_display_string/display_string/display_string.ino
Tenforward-cars/LCDWIKI_kbv
56527c9f9256ee2723ae3306f571a8825111e51b
[ "MIT" ]
null
null
null
Example/Example_03_display_string/display_string/display_string.ino
Tenforward-cars/LCDWIKI_kbv
56527c9f9256ee2723ae3306f571a8825111e51b
[ "MIT" ]
null
null
null
Example/Example_03_display_string/display_string/display_string.ino
Tenforward-cars/LCDWIKI_kbv
56527c9f9256ee2723ae3306f571a8825111e51b
[ "MIT" ]
0
null
null
// IMPORTANT: LCDWIKI_KBV LIBRARY MUST BE SPECIFICALLY // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD. //This program is a demo of displaying string //Set the pins to the correct ones for your development shield or breakout board. //when using the BREAKOUT BOARD only and using these 8 data lines to the LCD, //pin usage as follow: // CS CD WR RD RST D0 D1 D2 D3 D4 D5 D6 D7 //Arduino Uno A3 A2 A1 A0 A4 8 9 2 3 4 5 6 7 //Arduino Mega A3 A2 A1 A0 A4 8 9 2 3 4 5 6 7 //the 16bit mode only use in Mega.you must modify the mode in the file of lcd_mode.h //when using the BREAKOUT BOARD only and using these 16 data lines to the LCD, //pin usage as follow: // CS CD WR RD RST D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 //Arduino Mega 40 38 39 44 41 37 36 35 34 33 32 31 30 22 23 24 25 26 27 28 29 //Remember to set the pins to suit your display module! #include <LCDWIKI_GUI.h> //Core graphics library #include <LCDWIKI_KBV.h> //Hardware-specific library //the definiens of 8bit mode as follow: //if the IC model is known or the modules is unreadable,you can use this constructed function //LCDWIKI_KBV mylcd(ILI9341,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9325,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9328,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8357D,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8347G,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8347I,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9486,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ST7735S,A3,A2,A1,A0,A4); //model,cs,cd,wr,rd,reset //if the IC model is not known and the modules is readable,you can use this constructed function //LCDWIKI_KBV mylcd(240,320,A3,A2,A1,A0,A4);//width,height,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(320,480,A3,A2,A1,A0,A4);//width,height,cs,cd,wr,rd,reset //the definiens of 16bit mode as follow: //if the IC model is known or the modules is unreadable,you can use this constructed function //LCDWIKI_KBV mylcd(ILI9341,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9325,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9328,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8357D,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8347G,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(HX8347I,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9486,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9488,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ILI9481,40,38,39,44,41); //model,cs,cd,wr,rd,reset //LCDWIKI_KBV mylcd(ST7735S,40,38,39,44,41); //model,cs,cd,wr,rd,reset //if the IC model is not known and the modules is readable,you can use this constructed function //LCDWIKI_KBV mylcd(240,320,40,38,39,44,41);//width,height,cs,cd,wr,rd,reset for //LCDWIKI_KBV mylcd(320,480,40,38,39,44,41);//width,height,cs,cd,wr,rd,reset //define some color values #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF void setup() { mylcd.Init_LCD(); mylcd.Fill_Screen(BLACK); } void loop() { mylcd.Set_Text_Mode(0); //display 1 times string mylcd.Fill_Screen(0x0000); mylcd.Set_Text_color(RED); mylcd.Set_Text_Back_color(BLACK); mylcd.Set_Text_Size(1); mylcd.Print_String("Hello World!", 0, 0); mylcd.Print_Number_Float(01234.56789, 2, 0, 8, '.', 0, ' '); mylcd.Print_Number_Int(0xDEADBEF, 0, 16, 0, ' ',16); //mylcd.Print_String("DEADBEF", 0, 16); //display 2 times string mylcd.Set_Text_color(GREEN); mylcd.Set_Text_Size(2); mylcd.Print_String("Hello World!", 0, 40); mylcd.Print_Number_Float(01234.56789, 2, 0, 56, '.', 0, ' '); mylcd.Print_Number_Int(0xDEADBEF, 0, 72, 0, ' ',16); //mylcd.Print_String("DEADBEEF", 0, 72); //display 3 times string mylcd.Set_Text_color(BLUE); mylcd.Set_Text_Size(3); mylcd.Print_String("Hello World!", 0, 104); mylcd.Print_Number_Float(01234.56789, 2, 0, 128, '.', 0, ' '); mylcd.Print_Number_Int(0xDEADBEF, 0, 152, 0, ' ',16); // mylcd.Print_String("DEADBEEF", 0, 152); //display 4 times string mylcd.Set_Text_color(WHITE); mylcd.Set_Text_Size(4); mylcd.Print_String("Hello!", 0, 192); //display 5 times string mylcd.Set_Text_color(YELLOW); mylcd.Set_Text_Size(5); mylcd.Print_String("Hello!", 0, 224); //display 6 times string mylcd.Set_Text_color(RED); mylcd.Set_Text_Size(6); mylcd.Print_String("Hello!", 0, 266); delay(3000); }
41.205128
105
0.697158
true
1,960
437464e119d50b81b877d6605b4dca710b1139a3
2,328
ino
Arduino
baldcorder/blinky.ino
baldengineer/baldcorder-mk1
87a47778dcff87e72fbc70641bce2df0b75e0a74
[ "MIT" ]
3
2021-05-03T15:13:51.000Z
2022-02-11T20:44:11.000Z
baldcorder/blinky.ino
baldengineer/baldcorder-mk1
87a47778dcff87e72fbc70641bce2df0b75e0a74
[ "MIT" ]
null
null
null
baldcorder/blinky.ino
baldengineer/baldcorder-mk1
87a47778dcff87e72fbc70641bce2df0b75e0a74
[ "MIT" ]
0
null
null
/* Created by James Lewis, 2021 For element14 Present's Build Inside the Box Competiton MIT License Please see Acknowledgements.md for detailed acks. */ void init_gndn_blinky() { strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) strip.show(); // Turn OFF all pixels ASAP strip.setBrightness(neo_brightness); // Set BRIGHTNESS to about 1/5 (max = 255) } void turn_off_neopixels() { strip.clear(); strip.show(); } void process_tricorder_chase() { // based on the Adafruit theatreChase() example, converted to use millis() by James static uint8_t beat_counter = 0; static int8_t pulser_brightness = 0; static bool pulser_direction = true; static uint8_t pulser_color = 0; uint8_t pulser_location = (NEO_COUNT-1); if (millis() - previous_neo_scan >= neo_scan_speed) { strip.clear(); // Set all pixels in RAM to 0 (off) // handle the chasing sensor bar // 'c' counts up from 'b' to end of strip in steps of 4... for (int c = beat_counter; c < strip.numPixels(); c += 4) { strip.setPixelColor(c, SCAN_COLOR); // Set pixel 'c' to value 'color' } beat_counter++; if (beat_counter >= 4) beat_counter = 0; // now handle the stand alone (last one on the chain) if (pulser_direction) { pulser_brightness += pulser_step_size; if (pulser_brightness >= 125) { pulser_brightness = 125; pulser_direction = false; pulser_color++; } } else { pulser_brightness -= pulser_step_size; if (pulser_brightness <= 0) { pulser_brightness = 0; pulser_direction = true; pulser_color++; } } // clamp the color selector if (pulser_color >= 3) pulser_color =0; switch (pulser_color) { case 0: // red strip.setPixelColor(pulser_location, strip.Color(pulser_brightness,0,0)); break; case 1: // green strip.setPixelColor(pulser_location, strip.Color(0,pulser_brightness,0)); break; case 2: //blue strip.setPixelColor(pulser_location, strip.Color(0,0,pulser_brightness)); break; } AudioPlayer.criticalON(); strip.show(); // Update strip with new contents AudioPlayer.criticalOFF(); previous_neo_scan = millis(); } }
28.048193
85
0.636168
true
622
b81258c11b04114331b66a11d7781ce7c6426df3
769
ino
Arduino
sketches/rf/read.ino
mortenal/arduino
ce512edcf420cda5bf23cc7a6e14210c19ee36ce
[ "MIT" ]
null
null
null
sketches/rf/read.ino
mortenal/arduino
ce512edcf420cda5bf23cc7a6e14210c19ee36ce
[ "MIT" ]
null
null
null
sketches/rf/read.ino
mortenal/arduino
ce512edcf420cda5bf23cc7a6e14210c19ee36ce
[ "MIT" ]
0
null
null
#include <VirtualWire.h> int rxPin = 0; int pin = 0; void setup() { Serial.begin(9600); Serial.println("Listening"); vw_set_rx_pin(0); vw_rx_start(); vw_setup(2000); } void loop() { byte message[VW_MAX_MESSAGE_LEN]; byte messageLength = VW_MAX_MESSAGE_LEN; char messageC[VW_MAX_MESSAGE_LEN]; if (vw_get_message(message, &messageLength)) { for (int i = 0; i < messageLength; i++) { messageC[i] = (char) message[i]; } // Read like this on receiver int id; int temp; int light; sscanf(messageC, "ID:%i,TMP:%i,LIGHT:%i", &id, &temp, &light); Serial.write("id: "); Serial.println(id); Serial.write("tmp: "); Serial.println(temp); Serial.write("light: "); Serial.println(light); } }
18.756098
66
0.615085
true
223
38f5b0633f605811fad755cf25b28f30b8ff676f
6,961
ino
Arduino
Code/i2cSlave_FEARbot/i2cSlave_FEARbot.ino
Cosmic7373/ECE411
6fb7474e36c8402effa386511491a9b6de054e46
[ "MIT" ]
null
null
null
Code/i2cSlave_FEARbot/i2cSlave_FEARbot.ino
Cosmic7373/ECE411
6fb7474e36c8402effa386511491a9b6de054e46
[ "MIT" ]
null
null
null
Code/i2cSlave_FEARbot/i2cSlave_FEARbot.ino
Cosmic7373/ECE411
6fb7474e36c8402effa386511491a9b6de054e46
[ "MIT" ]
1
2019-10-22T20:18:09.000Z
2019-10-22T20:18:09.000Z
// Bliss Brass // 11-29-19 // ECE 411 Capstone Project FEAR BOT // 'Runs' away from detected noises // Set board to Leonardo ETH (should be same pinout as normal Leonardo) // To Re-program hold physical Reset button down until it says "Uploading" #include <Wire.h> int z = 370; int rightForwards = 10; // 10 and 11 paired int rightBackwards = 11; int leftBackwards = 12; // 12 and 6 paired int leftForwards = 6; int cat = 450; //int brightness = 0; //int fadeAmount = 5; void setup() { Wire.begin(4); // Turning Atmega into a slave on address 0x04 Wire.onReceive(receiveEvent); // On start sequence call function Serial.begin(9600); // Set the Baud rate pinMode(rightForwards, OUTPUT); pinMode(rightBackwards, OUTPUT); pinMode(leftForwards, OUTPUT); pinMode(leftBackwards, OUTPUT); // AtMega32u4 physical pins // PB6 Pin 30 and PB7 Pin 12 paired // PD6 Pin 26 and PD7 Pin 27 Paired } void loop() { delay(10); // Small delay for Z to update properlly // Noise is to the Back-Right turn LEFT if ((250 > z) && (z > 130)) { //Serial.print("Z is RIGHT"); //Serial.println(z); for (int i = 5000; i > 0; i--) { analogWrite(leftBackwards, 255); analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds analogWrite(leftBackwards, 0); analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(10); //delay to allow motors to settle for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range /*analogWrite(control1, brightness); brightness = brightness + fadeAmount; if (brightness <= 0 || brightness >= 255) { fadeAmount = -fadeAmount; } delay(30);*/ } // MIGHT HAVE ERRORS // Noise is directly in FRONT turn around! else if (z == 270) { for (int i = 7500; i > 0; i--) { analogWrite(leftBackwards, 255); analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds analogWrite(leftBackwards, 0); analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(10); for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range } // Noise is to the front left turn RIGHT else if (z == 250) { for (int i = 6500; i > 0; i--) { analogWrite(leftBackwards, 255); analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds analogWrite(leftBackwards, 0); analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(10); for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range } // Noise is to the front right turn LEFT else if (z == 290) { for (int i = 6500; i > 0; i--) { analogWrite(leftForwards, 255); analogWrite(rightBackwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds analogWrite(leftForwards, 0); analogWrite(rightBackwards, 0); delayMicroseconds(25); } delay(10); for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range } // Noise is to the left turn RIGHT else if (((50 > z) && (z >= 0)) || ((360 >= z) && (z > 290))) { //Serial.print("Z is LEFT"); //Serial.println(z); for (int i = 5000; i > 0; i--) { analogWrite(leftForwards, 255); analogWrite(rightBackwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds analogWrite(leftForwards, 0); analogWrite(rightBackwards, 0); delayMicroseconds(25); } delay(10); for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range } // Noise is behind drive STRAIGHT else if ((130 >= z) && (z >= 50)) { //Serial.print("Z is STRAIGHT "); //Serial.println(z); for (int i = 15000; i > 0; i--) { analogWrite(leftForwards, 255); // Setting V to max (Voltage) analogWrite(rightForwards, 255); delayMicroseconds(75); // Delaying 50 Micro Seconds for PWM analogWrite(leftForwards, 0); // Setting V to 0 analogWrite(rightForwards, 0); delayMicroseconds(25); } delay(cat); // Delay to counter act motor sound self activation z = 370; // Setting Z outside the trigger range } else { // Idle state } } void receiveEvent(int howMany) { // Loop through all sent bytes String buff; // insert analogWrite all zero'd out here testing delays analogWrite(rightForwards, 0); analogWrite(rightBackwards, 0); analogWrite(leftForwards, 0); analogWrite(leftBackwards, 0); while(0 < Wire.available()) { char c = Wire.read(); //Serial.print(c); buff = buff + c; } Serial.println(buff); z = buff.toInt(); Serial.print("Z is "); Serial.println(z); }
33.628019
82
0.606666
true
1,954
d3dc7739e013d4c2ab193fb1452420c5afa7a3fe
2,081
ino
Arduino
docs/Lesson 5 Line Tracking Car/Line_tracking_car/Line_tracking_car.ino
dim13/elegoo
d4db41ad0adc0f708354eb8625db9cf7ec56e0c8
[ "0BSD" ]
null
null
null
docs/Lesson 5 Line Tracking Car/Line_tracking_car/Line_tracking_car.ino
dim13/elegoo
d4db41ad0adc0f708354eb8625db9cf7ec56e0c8
[ "0BSD" ]
null
null
null
docs/Lesson 5 Line Tracking Car/Line_tracking_car/Line_tracking_car.ino
dim13/elegoo
d4db41ad0adc0f708354eb8625db9cf7ec56e0c8
[ "0BSD" ]
0
null
null
//www.elegoo.com //2016.09.12 int in1=9; int in2=8; int in3=7; int in4=6; int ENA=10; int ENB=5; int ABS=130; void _mForward() { analogWrite(ENA,ABS); analogWrite(ENB,ABS); digitalWrite(in1,LOW); digitalWrite(in2,HIGH); digitalWrite(in3,LOW); digitalWrite(in4,HIGH); Serial.println("go forward!"); } void _mBack() { analogWrite(ENA,ABS); analogWrite(ENB,ABS); digitalWrite(in1,HIGH); digitalWrite(in2,LOW); digitalWrite(in3,HIGH); digitalWrite(in4,LOW); Serial.println("go back!"); } void _mleft() { analogWrite(ENA,ABS); analogWrite(ENB,ABS); digitalWrite(in1,LOW); digitalWrite(in2,HIGH); digitalWrite(in3,HIGH); digitalWrite(in4,LOW); Serial.println("go left!"); } void _mright() { analogWrite(ENA,ABS); analogWrite(ENB,ABS); digitalWrite(in1,HIGH); digitalWrite(in2,LOW); digitalWrite(in3,LOW); digitalWrite(in4,HIGH); Serial.println("go right!"); } void _mStop() { digitalWrite(ENA,LOW); digitalWrite(ENB,LOW); Serial.println("Stop!"); } void setup() { Serial.begin(9600); } void loop() { int num1,num2,num3; num1=digitalRead(11); num2=digitalRead(4); num3=digitalRead(2); if((num1==0)&&num2&&num3) { _mleft(); //The sensor detected that right car turn left immediately when it meets black line delay(2); while(1){ num2=digitalRead(2); //Cycle to judge degree of intermediate sensor, if(num2==1) { _mleft(); //If num2==1 does not go to the middle position, continue to turn left. delay(2);} else break; //Detection of num2==0 instructions turned over, out of the loop, detection of three sensors’ statusand then make appropriate action } //The following and so on } else if(num2&&num1&&(num3==0)) { _mright(); delay(2); while(1) { num2=digitalRead(2); if(num2==1){ _mright(); delay(2);} else break; } } else { _mForward(); delay(2); } }
19.632075
165
0.601153
true
624
b566d2d2babe5aaebfbe2d611f0c0b7dbde67474
3,063
ino
Arduino
sketchbook/mirror/mirrora/mirrora.ino
Playaowl/artworks
bfe2abc844851ce054e1233261364a502cd30561
[ "MIT" ]
1
2020-08-14T01:03:47.000Z
2020-08-14T01:03:47.000Z
sketchbook/mirror/mirrora/mirrora.ino
Playaowl/artworks
bfe2abc844851ce054e1233261364a502cd30561
[ "MIT" ]
null
null
null
sketchbook/mirror/mirrora/mirrora.ino
Playaowl/artworks
bfe2abc844851ce054e1233261364a502cd30561
[ "MIT" ]
0
null
null
#include <Wire.h> //define our colors for LED Array #define GREEN 0x01 #define RED 0x02 #define ORANGE 0x03 //define the SPI pins for the LED Array #define DATAOUT 11//MOSI #define DATAIN 12//MISO #define SPICLOCK 13//sck #define SLAVESELECT 10//ss char ledArray [64]; byte pixelTempL; byte pixelTempH; int ledNum = 1; char addr = 0x69; int celsius; void setup() { Wire.begin(); Serial.begin(115200); byte clr; SPCR = B01010001; //SPI Registers SPSR = SPSR & B11111110; //make sure the speed is 125KHz clr=SPSR; clr=SPDR; delay(10); //Set the pin modes for the RG matrix pinMode(DATAOUT, OUTPUT); pinMode(DATAIN, INPUT); pinMode(SPICLOCK,OUTPUT); pinMode(SLAVESELECT,OUTPUT); //Make sure the RG matrix is deactivated digitalWrite(SLAVESELECT,HIGH); } void loop() { //First two data registers for the pixel temp data are 0x80 and 0x81 pixelTempL=0x80; pixelTempH=0x81; //Get Temperature Data for each pixel in the 8x8 array. Will loop 64 times. for(int pixel = 0; pixel <= 63; pixel++){ //Get lower level pixel temp byte Wire.beginTransmission(addr); Wire.write(pixelTempL); Wire.endTransmission(); Wire.requestFrom(addr,1); byte lowerLevel = Wire.read(); // //Get upper level pixel temp byte Wire.beginTransmission(addr); Wire.write(pixelTempH); Wire.endTransmission(); Wire.requestFrom(addr,1); byte upperLevel = Wire.read(); //Combine the two bytes together to complete the 12-bit temp reading int temperature = ((upperLevel << 8) | lowerLevel); //Temperature data is in two's compliment, do conversion. if (upperLevel != 0) { temperature = -(2048 - temperature); } celsius = temperature*0.25; //Determine LED color based on temperature of pixel if (celsius < 26) { ledArray[pixel]=GREEN; } else if (celsius >=26 && celsius <=30) { ledArray[pixel]=ORANGE; } else { ledArray[pixel]=RED; } //Go to next pixel by advancing both the low and high bit two register values pixelTempL=pixelTempL+2; pixelTempH=pixelTempH+2; } //Thermistor Register - Optional Wire.beginTransmission(addr); Wire.write(0x0E); Wire.endTransmission(); Wire.requestFrom(addr,1); byte upperLevelTherm = Wire.read(); Wire.beginTransmission(addr); Wire.write(0x0F); Wire.endTransmission(); Wire.requestFrom(addr,1); byte lowerLevelTherm = Wire.read(); int temperatureTherm = ((lowerLevelTherm << 8) | upperLevelTherm); int celsiusTherm = temperatureTherm*0.0625; //Transfer color contents of LED array for display for(int pixel=0; pixel<=63; pixel++){ digitalWrite(SLAVESELECT, LOW); delayMicroseconds(500); spi_transfer(ledArray[pixel]); delayMicroseconds(500); digitalWrite(SLAVESELECT, HIGH); } } //end loop //LED array send function char spi_transfer(volatile char data) { SPDR = data; // Start the transmission while (!(SPSR & (1<<SPIF))) // Wait for the end of the transmission { }; return SPDR; // return the received byte }
27.106195
81
0.683317
true
876
b57e7d0ecb27395a9d09277020bd258fa126fb53
5,021
ino
Arduino
tempServer.ino
ryanbillingsley/blackmagic-arduino
5cab5c76ea121eb1c84375b61cc4fc221c231e69
[ "MIT" ]
null
null
null
tempServer.ino
ryanbillingsley/blackmagic-arduino
5cab5c76ea121eb1c84375b61cc4fc221c231e69
[ "MIT" ]
null
null
null
tempServer.ino
ryanbillingsley/blackmagic-arduino
5cab5c76ea121eb1c84375b61cc4fc221c231e69
[ "MIT" ]
0
null
null
#include <Adafruit_CC3000.h> #include <SPI.h> #include "utility/debug.h" #include "utility/socket.h" #include <OneWire.h> #include <DallasTemperature.h> // Data wire is plugged into pin 2 on the Arduino #define ONE_WIRE_BUS 2 #define PULL_UP 8 #define TEMPERATURE_PRECISION 9 // These are the interrupt and control pins #define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin! // These can be any two pins #define ADAFRUIT_CC3000_VBAT 5 #define ADAFRUIT_CC3000_CS 10 // Use hardware SPI for the remaining pins // On an UNO, SCK = 13, MISO = 12, and MOSI = 11 Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIVIDER); // you can change this clock speed #define WLAN_SSID "Billingsley" // cannot be longer than 32 characters! #define WLAN_PASS "bagdemagus" // Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 #define WLAN_SECURITY WLAN_SEC_WPA2 #define LISTEN_PORT 80 // What TCP port to listen on for connections. Adafruit_CC3000_Server server(LISTEN_PORT); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); void setup(void) { pinMode(PULL_UP, INPUT); digitalWrite(PULL_UP, HIGH); Serial.begin(115200); delay(1000); Serial.println(F("Hello, CC3000!\n")); Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC); sensors.begin(); Serial.print(F("Found ")); Serial.print(sensors.getDeviceCount(), DEC); Serial.println(F(" devices.")); /* Initialise the module */ Serial.println(F("\nInitializing...")); if (!cc3000.begin()) { Serial.println(F("Couldn't begin()! Check your wiring?")); while(1); } Serial.print(F("\nAttempting to connect to ")); Serial.println(WLAN_SSID); if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) { Serial.println(F("Failed!")); while(1); } Serial.println(F("Connected!")); Serial.println(F("Request DHCP")); while (!cc3000.checkDHCP()) { delay(100); // ToDo: Insert a DHCP timeout! } /* Display the IP address DNS, Gateway, etc. */ while (! displayConnectionDetails()) { delay(1000); } // Start listening for connections server.begin(); Serial.println(F("Listening for connections...")); } void loop(void) { Adafruit_CC3000_ClientRef client = server.available(); if (client) { // an http request ends with a blank line Serial.println(F("client found")); boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); // if you've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { // send a standard http response header float temp = requestTemperature(); client.println(F("HTTP/1.1 200 OK")); client.println(F("Content-Type: application/json")); client.println(F("")); client.print(F("{ \"temp\": ")); client.print(temp); client.print(F("}")); client.println(); Serial.print("Free RAM: "); Serial.println(getFreeRam(), DEC); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(100); // close the connection: client.close(); } } /**************************************************************************/ /*! @brief Tries to read the IP address and other connection details */ /**************************************************************************/ bool displayConnectionDetails(void) { uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv; if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv)) { Serial.println(F("Unable to retrieve the IP Address!\r\n")); return false; } else { Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress); Serial.println(); return true; } } float requestTemperature() { // call sensors.requestTemperatures() to issue a global temperature // request to all devices on the bus Serial.print(F("Requesting temperatures...")); sensors.requestTemperatures(); // Send the command to get temperatures //Sensor 1 float temp_in_c0 = sensors.getTempCByIndex(0); float temp_in_f0 = DallasTemperature::toFahrenheit(temp_in_c0); Serial.println(temp_in_f0); return temp_in_f0; }
29.023121
107
0.629158
true
1,240
d28274ab6f113d6d3a9bff37cd2103bb5e63d995
540
ino
Arduino
libraries/LSM303/examples/Heading/Heading.ino
rvdende/arduino-locator
974e8de8ff596f5eac534921fb43f63cc23e48b1
[ "MIT" ]
1
2021-01-29T01:44:00.000Z
2021-01-29T01:44:00.000Z
libraries/LSM303/examples/Heading/Heading.ino
rvdende/arduino-locator
974e8de8ff596f5eac534921fb43f63cc23e48b1
[ "MIT" ]
null
null
null
libraries/LSM303/examples/Heading/Heading.ino
rvdende/arduino-locator
974e8de8ff596f5eac534921fb43f63cc23e48b1
[ "MIT" ]
0
null
null
#include <Wire.h> #include <LSM303.h> LSM303 compass; void setup() { Serial.begin(9600); Wire.begin(); compass.init(); compass.enableDefault(); // Calibration values. Use the Calibrate example program to get the values for // your compass. compass.m_min.x = -520; compass.m_min.y = -570; compass.m_min.z = -770; compass.m_max.x = +540; compass.m_max.y = +500; compass.m_max.z = 180; } void loop() { compass.read(); int heading = compass.heading((LSM303::vector){0,-1,0}); Serial.println(heading); delay(100); }
23.478261
80
0.664815
true
155
162cd293669d64cd8dc2e87a09ed329f13950eaa
366
ino
Arduino
code/active_buz/active_buz.ino
JaledMC/Learning-arduino
9c9a726ba6f7d2dbea20085a277d6068e49cb812
[ "MIT" ]
1
2019-03-18T16:52:31.000Z
2019-03-18T16:52:31.000Z
code/active_buz/active_buz.ino
JaledMC/Learning-arduino
9c9a726ba6f7d2dbea20085a277d6068e49cb812
[ "MIT" ]
null
null
null
code/active_buz/active_buz.ino
JaledMC/Learning-arduino
9c9a726ba6f7d2dbea20085a277d6068e49cb812
[ "MIT" ]
0
null
null
void setup() { pinMode(5,OUTPUT); //configuramos las salidas de los leds pinMode(4,INPUT); //configuramos las salidas de los leds } // the loop routine runs over and over again forever: void loop() { sonido=digitalRead(4); if(sonido){ digitalWrite(5,HIGH); delay(200); } else{ digitalWrite(5,LOW); delay(200); } }
17.428571
67
0.617486
true
108
56f869b22bea9f7039e3fbd4a50a4063a970b4cd
8,222
ino
Arduino
FoxkehRobo/misc/arduino/FoxkehRobo/FoxkehRobo.ino
puneetarora2000/adkworks
2bbf528973216e0c8784909b1b95745684c678ff
[ "BSD-2-Clause-FreeBSD" ]
4
2019-08-26T16:57:16.000Z
2019-09-01T00:42:31.000Z
FoxkehRobo/misc/arduino/FoxkehRobo/FoxkehRobo.ino
puneetarora2000/adkworks
2bbf528973216e0c8784909b1b95745684c678ff
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
FoxkehRobo/misc/arduino/FoxkehRobo/FoxkehRobo.ino
puneetarora2000/adkworks
2bbf528973216e0c8784909b1b95745684c678ff
[ "BSD-2-Clause-FreeBSD" ]
0
null
null
#include <SoftwareSerial.h> #include "SoftwareServo.h" #include "Geppa.h" // ============================= // Debug setting // #define DUMP_RAW // #define DUMP_PACKET // ============================= // variables for RBT-001 #define RBT_RX 8 #define RBT_TX 7 SoftwareSerial gDebug(RBT_RX, RBT_TX); // ============================= // ============================= #define SERVO_NUM 10 #define SERVO_ARM_LEFT 4 #define SERVO_ARM_RIGHT 5 #define SERVO_FOOT_LEFT 3 #define SERVO_FOOT_RIGHT 6 #define SERVO_HEAD_YAW 10 #define SERVO_HEAD_PITCH 9 #define SERVO_TAIL_YAW A2 #define SERVO_TAIL_PITCH A5 #define SERVO_EAR_LEFT 12 #define SERVO_EAR_RIGHT 11 //#define LED_POWER 9 //#define LED_EYE_LEFT 9 //#define LED_EYE_RIGHT 8 //#define PIN_ACCEL_X A1 //#define PIN_ACCEL_Y A2 //#define PIN_ACCEL_Z A3 //#define OFFSET_ACCEL_X 0 //#define OFFSET_ACCEL_Y 0 //#define OFFSET_ACCEL_Z 0 struct MyServo { SoftwareServo servo; int pulseMin; int pulseMax; long currentValue; long value; long stepWidth; }; struct MyServo myServos[SERVO_NUM]; void initMyServo(int idx, int pin, int pulseMin, int pulseMax, long initValue, long stepWidth) { pinMode(pin, OUTPUT); myServos[idx].pulseMin = pulseMin; myServos[idx].pulseMax = pulseMax; myServos[idx].currentValue = initValue; myServos[idx].value = initValue; myServos[idx].stepWidth = stepWidth; myServos[idx].servo.attach(pin); myServos[idx].servo.setMinimumPulse(pulseMin); myServos[idx].servo.setMaximumPulse(pulseMax); } // ============================= void handleRecvPacket(unsigned char packetType, unsigned char opCode, int dataLen, unsigned char* data); Geppa g_geppa(handleRecvPacket); void setup() { // ボーレートを指定して通信開始 gDebug.begin(9600); Serial.begin(38400); gDebug.println("Serial connected"); // pinMode(LED_EYE_LEFT, OUTPUT); // pinMode(LED_EYE_RIGHT, OUTPUT); { int rightArmOffset = -100; int footOffset = 100; initMyServo(0, SERVO_ARM_LEFT, 500, 2400, 0x7F, 0xFF); initMyServo(1, SERVO_ARM_RIGHT, 500+rightArmOffset, 2400+rightArmOffset, 0x7F, 0xFF); initMyServo(2, SERVO_FOOT_LEFT, 1000+footOffset, 1900+footOffset, 0x7F, 0xFF); initMyServo(3, SERVO_FOOT_RIGHT, 1000-footOffset, 1900-footOffset, 0x7F, 0xFF); initMyServo(4, SERVO_HEAD_YAW, 1000, 1900, 0x7F, 0xFF); //initMyServo(4, SERVO_HEAD_YAW, 500, 2400, 0x7F, 0xFF); initMyServo(5, SERVO_HEAD_PITCH, 500, 2400, 0x7F, 0xFF); initMyServo(6, SERVO_TAIL_YAW, 500, 2400, 0x7F, 0xFF); initMyServo(7, SERVO_TAIL_PITCH, 500, 2400, 0x7F, 0xFF); initMyServo(8, SERVO_EAR_LEFT, 800, 2200, 0x7F, 0xFF); initMyServo(9, SERVO_EAR_RIGHT, 800, 2200, 0x7F, 0xFF); } // { // pinMode(PIN_ACCEL_X, INPUT); // pinMode(PIN_ACCEL_Y, INPUT); // pinMode(PIN_ACCEL_Z, INPUT); // } } void loop() { // データ受信 //if (Serial.available() > 0) { // for (int i=0;i<2 && Serial.available() > 0;i++) { while(Serial.available() > 0) { unsigned char c = Serial.read(); #ifdef DUMP_RAW gDebug.print(' '); gDebug.print(c, HEX); #endif g_geppa.feedData(c); } { // Sending the data received from Serial to Bluetooth for debug. if (gDebug.available() > 0) { while (gDebug.available() > 0) { unsigned char c = gDebug.read(); #ifdef DUMP_RAW gDebug.print(' '); gDebug.print(c, HEX); #endif Serial.write(c); } #ifdef DUMP_RAW gDebug.print("\nstate="); gDebug.print(g_geppa.state, DEC); gDebug.print("\nlen="); gDebug.print(g_geppa.len, DEC); gDebug.print("\n"); #endif } } { // Controlling servo angles for (int i=0;i<SERVO_NUM;i++) { long targetValue = myServos[i].value; if (myServos[i].currentValue + myServos[i].stepWidth < targetValue) { myServos[i].currentValue += myServos[i].stepWidth; } else if (myServos[i].currentValue - myServos[i].stepWidth > targetValue) { myServos[i].currentValue -= myServos[i].stepWidth; } else { myServos[i].currentValue = targetValue; } int val = map(myServos[i].currentValue, 0, 0xFF, 0, 180); myServos[i].servo.write(val); } SoftwareServo::refresh(); } delay(5); } void handleRecvPacket(unsigned char packetType, unsigned char opCode, int dataLen, unsigned char* data) { #ifdef DUMP_PACKET gDebug.print('('); gDebug.print(packetType, HEX); gDebug.print(','); gDebug.print(opCode, HEX); gDebug.print(','); gDebug.print(dataLen, HEX); gDebug.print(','); for (int i=0;i<dataLen;i++) { if (data[i] < 0x10) { gDebug.print('0'); } gDebug.print(data[i], HEX); } gDebug.print(')'); gDebug.print('\n'); #endif if (packetType == 0x01) { if (opCode == 0) { // ECHO int len = dataLen; unsigned char t = packetType + opCode + (0xFF & len) + (0xFF & (len<<8)); Serial.write(0x02); Serial.write(packetType); Serial.write(opCode); Serial.write((uint8_t)(0xFF & len)); Serial.write((uint8_t)(0xFF & (len<<8))); Serial.write((uint8_t)t); for (int i=0;i<dataLen;i++) { Serial.write(data[i]); } Serial.write(0x03); } else if (opCode == 1) { // SERVO_ANGLE if (dataLen != SERVO_NUM) { gDebug.print("dataLen is not SERVO_NUM.\n"); } else { for (int i=0;i<SERVO_NUM;i++) { myServos[i].value = data[i]; #ifdef DUMP_PACKET gDebug.print("Servo idx="); gDebug.print(i, DEC); gDebug.print(", value="); gDebug.print(myServos[i].value, HEX); gDebug.print("\n"); #endif } } // } else if (opCode == 2) { // // EYE_LED // unsigned char val = data[0]; // digitalWrite(LED_EYE_LEFT, (val & 1) ? HIGH:LOW); // digitalWrite(LED_EYE_RIGHT, (val & 2) ? HIGH:LOW); } else if (opCode == 3) { // POSE if (dataLen != SERVO_NUM + 2) { gDebug.print("dataLen is not (SERVO_NUM + 2).\n"); } else { int flags = (int)data[0] | (((int)data[1]) << 8); // int led = data[SERVO_NUM+2]; for (int i=0;i<SERVO_NUM;i++) { if (flags & (1<<i)) { myServos[i].value = data[i+2]; #ifdef DUMP_PACKET gDebug.print("Servo idx="); gDebug.print(i, DEC); gDebug.print(", value="); gDebug.print(myServos[i].value, HEX); gDebug.print("\n"); #endif } } // if (flags & (1<<SERVO_NUM)) { // digitalWrite(LED_EYE_LEFT, (led & 1) ? HIGH:LOW); // digitalWrite(LED_EYE_RIGHT, (led & 2) ? HIGH:LOW); // } } } /* else if (opCode == 4) { gDebug.print("OK\n"); // REQ_ACCEL int x = (analogRead(PIN_ACCEL_X) - OFFSET_ACCEL_X); int y = (analogRead(PIN_ACCEL_Y) - OFFSET_ACCEL_Y); int z = (analogRead(PIN_ACCEL_Z) - OFFSET_ACCEL_Z); byte data[] = { 0x02, 0x01, 0x05, 0x06, 0x00, 0x0C, (0xFF & (x >> 0)), (0xFF & (x >> 8)), (0xFF & (y >> 0)), (0xFF & (y >> 8)), (0xFF & (z >> 0)), (0xFF & (z >> 8)), 0x03 }; int n = sizeof(data)/sizeof(byte); for (int i=0;i<n;i++) { Serial.write(data[i]); } //Serial.print("("); //Serial.print(x, DEC); //Serial.print(","); //Serial.print(y, DEC); //Serial.print(","); //Serial.print(z, DEC); //Serial.print(")\n"); } */ // } else if (packetType == 0x69) { // // The message from RBT-001 // if (opCode == 0x11) { // gDebug.print("Transparent mode is started:"); // gDebug.print(data[0], HEX); // gDebug.print(":"); // gDebug.print(data[1], HEX); // gDebug.print("\n"); // } // else if (opCode == 0x0C) { // digitalWrite(LED_EYE_LEFT, HIGH); // digitalWrite(LED_EYE_RIGHT, HIGH); // gDebug.print("Bluetooth connection is established."); // gDebug.print("\n"); // } // else if (opCode == 0x0E) { // digitalWrite(LED_EYE_LEFT, LOW); // digitalWrite(LED_EYE_RIGHT, LOW); // gDebug.print("SPP Link released."); // gDebug.print("\n"); // } } }
28.449827
105
0.579178
true
2,619
1c531cb9518c4a6ae5516766f13e750a40a88cd8
12,727
ino
Arduino
firmware/NixieClock_PE_A_v2.0.1/NixieClock_PE_A_v2.0.1.ino
adm503/NixieClock
88e18819e9af49cc969ead512fdd5581df820e51
[ "MIT" ]
10
2021-01-02T13:31:46.000Z
2022-02-02T06:52:45.000Z
firmware/NixieClock_PE_A_v2.0.1/NixieClock_PE_A_v2.0.1.ino
adm503/NixieClock
88e18819e9af49cc969ead512fdd5581df820e51
[ "MIT" ]
null
null
null
firmware/NixieClock_PE_A_v2.0.1/NixieClock_PE_A_v2.0.1.ino
adm503/NixieClock
88e18819e9af49cc969ead512fdd5581df820e51
[ "MIT" ]
2
2021-03-11T14:09:19.000Z
2021-09-06T15:44:36.000Z
/*----------- Версия PE А 2.0.0 ---------------*/ /* Исходная версия: ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Скетч к проекту "Часы на ГРИ версия 2" Страница проекта (схемы, описания): https://alexgyver.ru/nixieclock_v2/ Исходники на GitHub: https://github.com/AlexGyver/NixieClock_v2 Нравится, как написан код? Поддержи автора! https://alexgyver.ru/support_alex/ Автор: AlexGyver Technologies, 2018 https://AlexGyver.ru/ ------------------------------------------------------------------------------ Изменено для другой разводки платы: Потапов Владислав: - добавлены секунды; - тактирование переведено на SQW-выход DS3231 (с прерыванием), прерывание таймера оригинального скетча (таймер 2) не используется; - таймер 0 и таймер 2 используются на одинаковых частотах = таймер 0, для управления тремя линиями светодиодов (PWM); - таймер 1 используется на частоте 32кГц для PWM генератора DC/DC и яркости неонки; - контроль выходного высокого напряжения через делитель на вывод А6; - подключен будильник, добавлено меню установки будильника и режим просмотра установки будильника; - мелодия будильника реализована на программной реализации мелодии в прерывании SQW; - (выключено) индикация включения будильника реализована через разные режимы моргания секундной точки; - часть эффектов переключения цифр срабатывает только при смене минут; - исправлен показ номера эффекта при переключении; - подключение BME-280, три режима для отображения результатов измерений; - неоновая лампа секундной точки заменена на ИН-19A. */ /* Управление: - При отображении часов: - М (двойной клик) - войти в режим настроек времени; - (удержание) - войти в режим настроек будильника; - "минус" (кратко) - переключает режимы подсветки ламп; - (удержание) - включает/отключает "глюки"; - "плюс" (кратко) - переключает режимы перелистывания цифр; - сенсор (кратко) - показать температуру, давление, влажность, установленное время будильника (только если будильник включен) и вернуться в режим отображения часов; - (удержание) - то же, что (кратко). - При срабатывании будильника (играет мелодия): - сенсор (кратко) - сброс сигнала, будильник остаётся включенным; - сенсор (удержание) - сброс сигнала, будильник остаётся включенным. - При демонстрации температуры, влажности, давлении, времени будильника: - сенсор (кратко) - переключиться на следующий параметр (давление, влажность, установленное время будильника, отображение часов); - (удержание) - вернуться в режим отображения часов; - При настройке времени: - М (кратко) - переключение между установкой часов и минут; - (удержание) - сброс текущей группы разрядов в 00; - "минус" (кратко) - уменьшение значения; - (удержание) - уменьшение значения на 5; - "плюс" (кратко) - увеличение значения; - (удержание) - уведичение значения на 5; - сенсор (кратко) - выход с сохранением установок; - сенсор (удержание) - выход с возвратом к прежнему значению. - При настройке будильника: - М (кратко) - переключение между установкой часов и минут; - (удержание) - сброс текущей группы разрядов в 00; - "минус" (кратко) - уменьшение значения; - (удержание) - уменьшение значения на 5; - "плюс" (кратко) - увеличение значения; - (удержание) - уведичение значения на 5; - сенсор (кратко) - выход с сохранением установок; - сенсор (удержание) - включение/выключение будильника. - Эффекты В РЕЖИМЕ ЧАСОВ: - Подсветка (циклически изменяется цвет: красный, зелёный, синий): - Дыхание; - Постоянное свечение; - Отключена. - Смена цифр (при смене на короткое время отображается номер эффекта во всех разрядах): - (0) Без эффекта; - (1) Плавное угасание; - (2) Перемотка по порядку числа; - (3) Перемотка по катодам; - (4) Поезд; - (5) Резинка. ----- исключено ----- - Поведение секундной точки зависит от того, включен ли будильник? устанавливается параметрами: - DOT_IN_TIME - когда будильник выключен; - DOT_IN_ALARM - когда будильник включен. Выбор поведения точки можно осуществлять из следующих величин: - DM_NULL, (0) точка постоянно выключена; - DM_ONCE, (1) точка моргает один раз в секунду (штатно); - DM_HALF, (2) точка изменяет яркость раз в секунду; - DM_TWICE,(3) точка моргает два раза в секунду; - DM_THREE,(4) точка моргает три раза в секунду; - DM_FULL, (5) точка постоянно включена ---- исключено ---- */ // ************************** НАСТРОЙКИ ************************** #define BOARD_TYPE 3 // тип платы часов: // 0 - IN-12 turned (индикаторы стоят правильно) // 1 - IN-12 (индикаторы перевёрнуты) // 2 - IN-14 (обычная и neon dot) // 3 - COVID 2019 (проект ADM503 и poty) #define DUTY 180 // скважность ШИМ. От скважности зависит напряжение! у меня 175 вольт при значении 180 и 145 вольт при 120 // ======================= ЭФФЕКТЫ ======================= // эффекты перелистывания часов enum FLIP_MODES: byte { FM_NULL, // (0) нет эффекта FM_SMOOTH, // (1) плавное угасание и появление (рекомендуемая скорость: 100-150), срабатывает только на минутах FM_LIST, // (2) перемотка по порядку числа (рекомендуемая скорость: 50-80) FM_CATHODE,// (3) перемотка по порядку катодов в лампе (рекомендуемая скорость: 30-50) FM_TRAIN, // (4) поезд (рекомендуемая скорость: 50-170), срабатывает только на минутах FM_ELASTIC }; // (5) резинка (рекомендуемая скорость: 50-150), срабатывает только на минутах // Выбранный активен при первом запуске и меняется кнопками. Запоминается в память byte FLIP_EFFECT = FM_SMOOTH; // ======================= ЯРКОСТЬ ======================= #define NIGHT_LIGHT 1 // менять яркость от времени суток (1 вкл, 0 выкл) #define NIGHT_START 23 // час перехода на ночную подсветку (BRIGHT_N) #define NIGHT_END 7 // час перехода на дневную подсветку (BRIGHT) #define INDI_BRIGHT 23 // яркость цифр дневная (1 - 24) !на 24 могут быть фантомные цифры! #define INDI_BRIGHT_N 3 // яркость ночная (1 - 24) /*#define DOT_BRIGHT 35 // яркость точки дневная (1 - 255) #define DOT_BRIGHT_N 25 // яркость точки ночная (1 - 255)*/ #define BACKL_BRIGHT 180 // макс. яркость подсветки ламп дневная (0 - 255) #define BACKL_BRIGHT_N 50 // макс. яркость подсветки ламп ночная (0 - 255, 0 - подсветка выключена) #define BACKL_MIN_BRIGHT 20 // мин. яркость подсветки ламп в режиме дыхание (0 - 255) #define BACKL_PAUSE 400 // пазуа "темноты" между вспышками подсветки ламп в режиме дыхание, мс // ======================= ГЛЮКИ ======================= #define GLITCH_MIN 30 // минимальное время между глюками, с #define GLITCH_MAX 120 // максимальное время между глюками, с // ====================== МИГАНИЕ ======================= /*#define DOT_TIME 500 // время мигания точки, мс #define DOT_TIMER 20 // шаг яркости точки, мс enum DOT_MODES: byte { DM_NULL, // (0) точка постоянно выключена DM_ONCE, // (1) точка моргает один раз в секунду (штатно) DM_HALF, // (2) точка изменяет яркость раз в секунду DM_TWICE, // (3) точка моргает два раза в секунду DM_THREE, // (4) точка моргает три раза в секунду DM_FULL }; // (5) точка постоянно включена #define DOT_IN_TIME DM_ONCE #define DOT_IN_ALARM DM_TWICE*/ #define BACKL_STEP 2 // шаг мигания подсветки #define BACKL_TIME 5000 // период подсветки, мс // ================== АНТИОТРАВЛЕНИЕ ==================== #define BURN_TIME 10 // период обхода индикаторов в режиме очистки, мс #define BURN_LOOPS 3 // количество циклов очистки за каждый период #define BURN_PERIOD 15 // период антиотравления, минут // *********************** ДЛЯ РАЗРАБОТЧИКОВ *********************** byte BACKL_MODE = 0; // Выбранный режим активен при запуске и меняется кнопками // скорость эффектов, мс (количество не меняй) byte FLIP_SPEED[] = {0, 60, 50, 40, 90, 90}; // количество эффектов byte FLIP_EFFECT_NUM = sizeof(FLIP_SPEED); boolean GLITCH_ALLOWED = 1; // 1 - включить, 0 - выключить глюки. Управляется кнопкой // --------- БУДИЛЬНИК --------- #define ALM_TIMEOUT 30 // таймаут будильника // --------- ПИНЫ --------- #define RTC_SYNC 2 // - подключение SQW выхода #define PIEZO 1 // - подключение пищалки #define AV_CTRL A6 // - вход контроля анодного напряжения #define KEY0 8 // - часы (десятки) #define KEY1 3 // - часы (единицы) #define KEY2 4 // - минуты (десятки) #define KEY3 13 // - минуты (единицы) #define KEY4 0 // - секунды (десятки) #define KEY5 7 // - секунды (единицы) #define GEN 9 // - генератор /* $$$ исправлено - вместо точки - ИН-19А */ #define DOT 10 // - ИН-19А #define BACKLR 11 // - выход на красные светодиоды подсветки #define BACKLG 6 // - выход на зелёные светодиоды подсветки #define BACKLB 5 // - выход на голубые светодиоды подсветки #define ALARM_STOP 12 // - кнопка остановки сигнала будильника // дешифратор #define DECODER0 A0 // - #define DECODER1 A1 // - #define DECODER2 A2 // - #define DECODER3 A3 // - // A4, A5 - I2C // A7 - аналоговая клавиатура #define NUMTUB 6 // количество разрядов (ламп) #define NUMMENU 4 // количество разрядов в меню // распиновка ламп #if (BOARD_TYPE == 0) const byte digitMask[] = {7, 3, 6, 4, 1, 9, 8, 0, 5, 2}; // маска дешифратора платы in12_turned (цифры нормальные) /* $$$исключен const */ volatile byte opts[] = {KEY0, KEY1, KEY2, KEY3, KEY4, KEY5}; // порядок индикаторов слева направо #define KEYPIN KEY4 // "подменный" пин для включения ИН-19А const byte cathodeMask[] = {1, 6, 2, 7, 5, 0, 4, 9, 8, 3}; // порядок катодов in12 #elif (BOARD_TYPE == 1) const byte digitMask[] = {2, 8, 1, 9, 6, 4, 3, 5, 0, 7}; // маска дешифратора платы in12 (цифры вверх ногами) volatile byte opts[] = {KEY5, KEY4, KEY3, KEY2, KEY1, KEY0}; // порядок индикаторов справа налево (для IN-12 turned) и ин-14 #define KEYPIN KEY1 // "подменный" пин для включения ИН-19А const byte cathodeMask[] = {1, 6, 2, 7, 5, 0, 4, 9, 8, 3}; // порядок катодов in12 #elif (BOARD_TYPE == 2) const byte digitMask[] = {9, 8, 0, 5, 4, 7, 3, 6, 2, 1}; // маска дешифратора платы in14 volatile byte opts[] = {KEY5, KEY4, KEY3, KEY2, KEY1, KEY0}; // порядок индикаторов справа налево (для IN-12 turned) и ин-14 #define KEYPIN KEY1 // "подменный" пин для включения ИН-19А const byte cathodeMask[] = {1, 0, 2, 9, 3, 8, 4, 7, 5, 6}; // порядок катодов in14 #elif (BOARD_TYPE == 3) const byte digitMask[] = {8, 9, 0, 1, 5, 2, 4, 6, 7, 3}; // маска дешифратора платы volatile byte opts[] = {KEY0, KEY1, KEY2, KEY3, KEY4, KEY5}; // порядок индикаторов слева направо #define KEYPIN KEY4 // "подменный" пин для включения ИН-19А const byte cathodeMask[] = {1, 6, 2, 7, 5, 0, 4, 9, 8, 3}; // порядок катодов #endif /* добавлено для ИН-19А */ enum IN19A_PINS: byte { IN_NULL, // (0) не подключен IN_K, // (1) буква К IN_n, // (2) буква n IN_mu, // (3) буква мю IN_CELS, // (4) знак градусы цельсия IN_PERC, // (5) знак процента IN_M, // (6) буква М IN_NONE, // (7) не подключен IN_P, // (8) буква Р IN_m }; // (9) буква m /* ард ног ном А0 7 4 А1 6 2 А2 4 8 А3 3 1 */ /* void dotSetMode(DOT_MODES dMode);*/
51.11245
135
0.585213
true
4,106
ada5bf46f40b4174d38951e4f1cb1c7d4b007dbb
128
ino
Arduino
waterboard.ino
terrorsl/waterboard
f6c18098855f5a5edc77157712c5bd2c48f976c8
[ "MIT" ]
null
null
null
waterboard.ino
terrorsl/waterboard
f6c18098855f5a5edc77157712c5bd2c48f976c8
[ "MIT" ]
null
null
null
waterboard.ino
terrorsl/waterboard
f6c18098855f5a5edc77157712c5bd2c48f976c8
[ "MIT" ]
0
null
null
#include"src/waterboard.h" WaterBoard wb; void setup() { Serial.begin(9600); wb.setup(); } void loop() { wb.loop(); }
9.142857
26
0.609375
true
39
4a645d296c047df312cad8ca5a272c3f0e690a09
754
ino
Arduino
sensor_signal/sensor_signal.ino
Mecha-LAN/Arduino_Code
785a9e770d640237601e76f7e1908e3b6485f8ef
[ "MIT" ]
null
null
null
sensor_signal/sensor_signal.ino
Mecha-LAN/Arduino_Code
785a9e770d640237601e76f7e1908e3b6485f8ef
[ "MIT" ]
null
null
null
sensor_signal/sensor_signal.ino
Mecha-LAN/Arduino_Code
785a9e770d640237601e76f7e1908e3b6485f8ef
[ "MIT" ]
0
null
null
const int TRIG = 9; const int ECHO = 2; const int STOP = 6; int stopDistance = 75; // measured in cm, kind of void setup() { // put your setup code here, to run once: pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT); pinMode(STOP, OUTPUT); analogWrite(TRIG, 128); Serial.begin(9800); // attachInterrupt(digitalPinToInterrupt(2), IR2, CHANGE); we will just use pulsein because we are integrating one sensor only } void loop() { float pulse = pulseIn(ECHO, HIGH, 15000)*170/10000; // Convert pulse width to distance in cm if(pulse < stopDistance && pulse != 0) // 100 cm is 1m, also ignore timeout values of 0 since the signal echo did not return digitalWrite(STOP, HIGH); else digitalWrite(STOP, LOW); }
31.416667
129
0.672414
true
212
2e8207a74aa9eb2711cdba40ccb4974b3057c79e
1,848
ino
Arduino
arduino/microview_laserscan/microview_laserscan.ino
turgaysenlet/carry
3833aed7884870a662edcc7cbf655aa556abb859
[ "Apache-2.0" ]
null
null
null
arduino/microview_laserscan/microview_laserscan.ino
turgaysenlet/carry
3833aed7884870a662edcc7cbf655aa556abb859
[ "Apache-2.0" ]
null
null
null
arduino/microview_laserscan/microview_laserscan.ino
turgaysenlet/carry
3833aed7884870a662edcc7cbf655aa556abb859
[ "Apache-2.0" ]
0
null
null
#include <ArduinoHardware.h> #include <MicroView.h> #include <ros.h> #include <ros/time.h> #include <std_msgs/String.h> int SCREEN_WIDTH = uView.getLCDWidth(); int SCREEN_HEIGHT = uView.getLCDHeight(); int SHAPE_SIZE = 600; int ROTATION_SPEED = 0; // ms delay between cube draws int a = 0; ros::NodeHandle nh; MicroViewWidget *widget1; void scan_cb( const std_msgs::String& cmd_msg) { // a++; // a %= 100; uView.clear(PAGE); uView.setCursor(0,8); uView.print("laser"); //widget1->setValue(a++); //uView.setCursor(0,50); //uView.print(cmd_msg.data); float p = 3.0f; float t = 45.0f; float x = (float)SCREEN_WIDTH/20.0f; uView.line(SCREEN_WIDTH/2,SCREEN_HEIGHT,SCREEN_WIDTH/2-3,SCREEN_HEIGHT-3); uView.line(SCREEN_WIDTH/2,SCREEN_HEIGHT,SCREEN_WIDTH/2+3,SCREEN_HEIGHT-3); uView.line(0,SCREEN_HEIGHT-3,SCREEN_WIDTH,SCREEN_HEIGHT-3); for (int i = 2; i < 40; i+=2) { int ii = i/2; float y0 = (float)(cmd_msg.data[i-2]- 48) * 10.0 + (float)(cmd_msg.data[i-1]- 48); float y1 = (float)(cmd_msg.data[i]- 48) * 10.0 + (float)(cmd_msg.data[i+1]- 48); uView.line(x*(ii-1),t-p*y0,x*ii,t-p*y1); } uView.display(); } ros::Subscriber<std_msgs::String> sub("/scan_string", scan_cb); void setup() { nh.initNode(); // nh.advertise(chatter); // put your setup code here, to run once: uView.begin(); uView.clear(PAGE); // clear page uView.setCursor(0,8); uView.print("laser"); uView.line(SCREEN_WIDTH/2,SCREEN_HEIGHT,SCREEN_WIDTH/2-3,SCREEN_HEIGHT-3); uView.line(SCREEN_WIDTH/2,SCREEN_HEIGHT,SCREEN_WIDTH/2+3,SCREEN_HEIGHT-3); uView.line(0,SCREEN_HEIGHT-3,SCREEN_WIDTH,SCREEN_HEIGHT-3); uView.display(); //widget1 = new MicroViewSlider(0,0,0,100); // declare widget0 as a Slider at x=0, y=0, min=0, max=100 nh.subscribe(sub); } void loop() { delay(10); nh.spinOnce(); }
28
106
0.67316
true
623
b4ceb8c082855cc6ecffa7223f3f6389c2a3d40d
1,491
ino
Arduino
Gyroscope/Gyros/Gyros.ino
totovr/Arduino
14a01869ae2f326362b0ee2cff9b464e3114d2b7
[ "MIT" ]
null
null
null
Gyroscope/Gyros/Gyros.ino
totovr/Arduino
14a01869ae2f326362b0ee2cff9b464e3114d2b7
[ "MIT" ]
null
null
null
Gyroscope/Gyros/Gyros.ino
totovr/Arduino
14a01869ae2f326362b0ee2cff9b464e3114d2b7
[ "MIT" ]
0
null
null
// Librerias I2C para controlar el mpu6050 // la libreria MPU6050.h necesita I2Cdev.h, I2Cdev.h necesita Wire.h #include "I2Cdev.h" #include "MPU6050.h" #include "Wire.h" // La dirección del MPU6050 puede ser 0x68 o 0x69, dependiendo // del estado de AD0. Si no se especifica, 0x68 estará implicito MPU6050 sensor; // Valores RAW (sin procesar) del acelerometro y giroscopio en los ejes x,y,z int ax, ay, az; int gx, gy, gz; void setup() { Serial.begin(115200); //Iniciando puerto serial Wire.begin(); //Iniciando I2C sensor.initialize(); //Iniciando el sensor if (sensor.testConnection()) Serial.println("Sensor iniciado correctamente"); else Serial.println("Error al iniciar el sensor"); pinMode(LED_BUILTIN, OUTPUT); } void loop() { // Leer las aceleraciones y velocidades angulares sensor.getAcceleration(&ax, &ay, &az); sensor.getRotation(&gx, &gy, &gz); //Mostrar las lecturas separadas por un [tab] Serial.print("a[x y z] g[x y z]:\t"); Serial.print(ax); Serial.print("\t"); Serial.print(ay); Serial.print("\t"); Serial.print(az); Serial.print("\t"); Serial.print(gx); Serial.print("\t"); Serial.print(gy); Serial.print("\t"); Serial.println(gz); if(az<20000) { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); }// wait for a second else { digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); } delay(1000); }
27.611111
83
0.677398
true
453
cda74aa25cc5a409c7120fccc23d25d0e5544b8c
4,372
ino
Arduino
Aruduino Sketches/epaper_arduinoMega/epaper_arduinoMega.ino
LukyVj/Open-Informant
ce84813f201feda0dfb838994ddad61801a16242
[ "MIT" ]
1
2021-09-03T00:07:44.000Z
2021-09-03T00:07:44.000Z
Aruduino Sketches/epaper_arduinoMega/epaper_arduinoMega.ino
LukyVj/Open-Informant
ce84813f201feda0dfb838994ddad61801a16242
[ "MIT" ]
null
null
null
Aruduino Sketches/epaper_arduinoMega/epaper_arduinoMega.ino
LukyVj/Open-Informant
ce84813f201feda0dfb838994ddad61801a16242
[ "MIT" ]
0
null
null
// Copyright 2013 Pervasive Displays, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language // governing permissions and limitations under the License. // This program is to illustrate the display operation as described in // the datasheets. The code is in a simple linear fashion and all the // delays are set to maximum, but the SPI clock is set lower than its // limit. Therfore the display sequence will be much slower than // normal and all of the individual display stages be clearly visible. // // Embedded Artists has modified Pervasive Display Inc's demo application // to run on the 2.7 inch E-paper Display module (EA-LCD-009 // #include <inttypes.h> #include <ctype.h> #include <SPI.h> #include <Wire.h> #include <EPD.h> #include <LM75A.h> #define EPD_SIZE EPD_2_7 // configure images for display size // change these to match display size above #define TEXT_IMAGE "helloworld.xbm" #define TEXT_BITS helloworld_bits #define PICTURE "text_hello_2_7.xbm" #define PICTURE_BITS text_hello_2_7_bits // no futher changed below this point // current version number #define DEMO_VERSION "1" // Add Images library to compiler path #include <Images.h> // this is just an empty file // images PROGMEM const #define unsigned #define char uint8_t #include TEXT_IMAGE #undef char #undef unsigned PROGMEM const #define unsigned #define char uint8_t #include PICTURE #undef char #undef unsigned // Arduino IO layout const int Pin_PANEL_ON = 2; const int Pin_BORDER = 3; const int Pin_DISCHARGE = 4; const int Pin_PWM = 5; const int Pin_RESET = 6; const int Pin_BUSY = 7; const int Pin_EPD_CS = 8; const int Pin_RED_LED = 52; // LED anode through resistor to I/O pin // LED cathode to Ground #define LED_ON HIGH #define LED_OFF LOW // pre-processor convert to string #define MAKE_STRING1(X) #X #define MAKE_STRING(X) MAKE_STRING1(X) // define the E-Ink display EPD_Class EPD(EPD_SIZE, Pin_PANEL_ON, Pin_BORDER, Pin_DISCHARGE, Pin_PWM, Pin_RESET, Pin_BUSY, Pin_EPD_CS, SPI); LM75A_Class LM75A; // I/O setup void setup() { pinMode(Pin_RED_LED, OUTPUT); pinMode(Pin_PWM, OUTPUT); pinMode(Pin_BUSY, INPUT); pinMode(Pin_RESET, OUTPUT); pinMode(Pin_PANEL_ON, OUTPUT); pinMode(Pin_DISCHARGE, OUTPUT); pinMode(Pin_BORDER, OUTPUT); pinMode(Pin_EPD_CS, OUTPUT); digitalWrite(Pin_RED_LED, LOW); digitalWrite(Pin_PWM, LOW); digitalWrite(Pin_RESET, LOW); digitalWrite(Pin_PANEL_ON, LOW); digitalWrite(Pin_DISCHARGE, LOW); digitalWrite(Pin_BORDER, LOW); digitalWrite(Pin_EPD_CS, LOW); SPI.begin(); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); SPI.setClockDivider(SPI_CLOCK_DIV4); Serial.begin(9600); #if !defined(__MSP430_CPU__) // wait for USB CDC serial port to connect. Arduino Leonardo only while (!Serial) { } #endif Serial.println(); Serial.println(); Serial.println("Demo version: " DEMO_VERSION); Serial.println("Display: " MAKE_STRING(EPD_SIZE)); Serial.println(); } static int state = 0; // main loop void loop() { int temperature = LM75A.read(); Serial.print("Temperature = "); Serial.print(temperature); Serial.println(" Celcius"); EPD.begin(); // power up the EPD panel EPD.setFactor(temperature); // adjust for current temperature switch(state) { default: case 0: // clear the screen EPD.clear(); state = 1; break; case 1: // clear -> text EPD.image(PICTURE_BITS); ++state; break; case 2: // text -> picture EPD.image(PICTURE_BITS, TEXT_BITS); ++state; break; case 3: // picture -> text EPD.image(TEXT_BITS, PICTURE_BITS); state = 2; // backe to picture nex time break; } EPD.end(); // power down the EPD panel // flash LED for 5 seconds for (int x = 0; x < 50; ++x) { digitalWrite(Pin_RED_LED, LED_ON); delay(50); digitalWrite(Pin_RED_LED, LED_OFF); delay(50); } }
23.255319
112
0.7086
true
1,164
0925d515ff7bb602b85705867341a08af8f225f8
6,485
ino
Arduino
examples/Getting_Started_SimpleClient_Mesh/Getting_Started_SimpleClient_Mesh.ino
nRF24/RF24Ethernet
229e7c330b7a09712204d9d125c37b66f4c76ae5
[ "Unlicense" ]
52
2017-03-25T22:07:35.000Z
2022-02-20T08:39:06.000Z
examples/Getting_Started_SimpleClient_Mesh/Getting_Started_SimpleClient_Mesh.ino
nRF24/RF24Ethernet
229e7c330b7a09712204d9d125c37b66f4c76ae5
[ "Unlicense" ]
12
2019-05-13T02:12:02.000Z
2021-11-06T14:56:51.000Z
examples/Getting_Started_SimpleClient_Mesh/Getting_Started_SimpleClient_Mesh.ino
nRF24/RF24Ethernet
229e7c330b7a09712204d9d125c37b66f4c76ae5
[ "Unlicense" ]
34
2017-03-26T13:58:37.000Z
2021-12-22T14:44:46.000Z
/* * ************************************************************************* * RF24Ethernet Arduino library by TMRh20 - 2014-2015 * * Automated (mesh) wireless networking and TCP/IP communication stack for RF24 radio modules * * RF24 -> RF24Network -> UIP(TCP/IP) -> RF24Ethernet * -> RF24Mesh * * Documentation: http://nRF24.github.io/RF24Ethernet/ * * ************************************************************************* * * What it does?: * * RF24Ethernet allows tiny Arduino-based sensors to automatically * form and maintain an interconnected, wireless mesh network capable of utilizing * standard (TCP/IP) protocols for communication. ( Nodes can also use * the underlying RF24Network/RF24Mesh layers for internal communication. ) * * Any device with a browser can connect to and control various sensors, and/or the sensors * can communicate directly with any number of IP based systems. * * Why? * * Enabling TCP/IP directly on the sensors enables users to connect directly * to the sensor nodes with any standard browser, http capable tools, or with * virtually any related protocol. Nodes are able to handle low level communications * at the network layer and/or TCP/IP based connections. * * Remote networks can be easily interconnected using SSH tunnelling, VPNs etc., and * sensor nodes can be configured to communicate without the need for an intermediary or additional programming. * * * ************************************************************************* * Example Network: * * In the following example, 8 Arduino devices have assembled themselves into a * wireless mesh network, with 3 sensors attached directly to RPi/Linux. Five * additional sensors are too far away to connect directly to the RPi/Gateway, * so they attach automatically to the closest sensor, which will automatically * relay all communications for the distant node. * * Example network: * * Arduino 4 <-> Arduino 1 <-> Raspberry Pi <-> Webserver * Arduino 5 <-> OR Arduino+Linux <-> Database * Arduino 6 <-> <-> PHP * <-> BASH (Wget, Curl, etc) * Arduino 7 <-> Arduino 2 <-> <-> Web-Browser * Arduino 8 <-> <-> Python * Arduino 3 <-> <-> NodeJS * <-> SSH Tunnel <-> Remote RF24Ethernet Sensor Network * <-> VPN <-> * * In addition to communicating with external systems, the nodes are able to * communicate internally using TCP/IP, and/or at the RF24Mesh/RF24Network * layers. * * ************************************************************************** * * RF24Ethernet simple web client example * * RF24Ethernet uses the fine uIP stack by Adam Dunkels <adam@sics.se> * * In order to minimize memory use and program space: * 1. Open the RF24Network library folder * 2. Edit the RF24Networl_config.h file * 3. Un-comment #define DISABLE_USER_PAYLOADS * 4. Remember to set it back for normal operation * * This example will get you some pizza and a book to read * */ #include <RF24.h> #include <RF24Network.h> #include <RF24Mesh.h> #include <RF24Ethernet.h> //#include <printf.h> /*** Configure the radio CE & CS pins ***/ RF24 radio(7, 8); RF24Network network(radio); RF24Mesh mesh(radio, network); RF24EthernetClass RF24Ethernet(radio, network, mesh); EthernetClient client; // The hosts we will be connecting to // Note: The gateway will need to be able to forward traffic for internet hosts, see the documentation IPAddress icewind(109, 120, 203, 163); //http://109.120.203.163/web/blyad.club/library/litrature/Salvatore,%20R.A/Salvatore,%20R.A%20-%20Icewind%20Dale%20Trilogy%201%20-%20Crystal%20Shard,%20The.txt IPAddress pizza(94, 199, 58, 243); //http://fiikus.net/asciiart/pizza.txt IPAddress host(pizza); void setup() { Serial.begin(115200); //printf_begin(); Serial.println(F("Start")); // Set the IP address we'll be using. The last octet mast match the nodeID (9) IPAddress myIP(10, 10, 2, 4); Ethernet.begin(myIP); mesh.begin(); // If you'll be making outgoing connections from the Arduino to the rest of // the world, you'll need a gateway set up. IPAddress gwIP(10, 10, 2, 2); Ethernet.set_gateway(gwIP); } uint32_t counter = 0; uint32_t reqTimer = 0; uint32_t mesh_timer = 0; void loop() { // Send a p or g character over serial to switch between hosts if (Serial.available()) { char c = Serial.read(); if (c == 'p') { host = pizza; } else if (c == 'g') { host = icewind; } } // Optional: If the node needs to move around physically, or using failover nodes etc., // enable address renewal if (millis() - mesh_timer > 12000) { //Every 12 seconds, test mesh connectivity mesh_timer = millis(); if ( ! mesh.checkConnection() ) { //refresh the network address if (!mesh.renewAddress()) { mesh.begin(); } } } size_t size; if ((size = client.available()) > 0) { char c = client.read(); Serial.print(c); counter++; } // if the server's disconnected, stop the client: if (!client.connected()) { Serial.println(); Serial.println(F("Disconnect. Waiting for disconnect timeout")); client.stop(); // Wait 5 seconds between requests // Calling client.available(); or Ethernet.update(); is required during delays // to keep the stack updated reqTimer = millis(); while (millis() - reqTimer < 5000 && !client.available() ) { } connect(); } // We can do other things in the loop, but be aware that the loop will // briefly pause while IP data is being processed. } void connect() { Serial.println(F("connecting")); if (client.connect(host, 80)) { Serial.println(F("connected")); // Make an HTTP request: if (host == pizza) { client.write("GET /asciiart/pizza.txt HTTP/1.1\nHost: fiikus.net\n"); } else { client.println("GET /web/blyad.club/library/litrature/Salvatore,%20R.A/Salvatore,%20R.A%20-%20Icewind%20Dale%20Trilogy%201%20-%20Crystal%20Shard,%20The.txt HTTP/1.1"); client.println("Host: 109.120.203.163"); } client.println("Connection: close"); client.println(); } else { // if you didn't get a connection to the server: Serial.println(F("connection failed")); } }
33.95288
198
0.625752
true
1,550
bc6f858f677b781e5ccc67e08445779352649f54
2,739
ino
Arduino
examples/RTU/ESP32-Concurent/ESP32-Concurent.ino
mako777/modbus-esp8266
47904263660a07e8a24151ccd0679722d9b514d7
[ "BSD-3-Clause" ]
null
null
null
examples/RTU/ESP32-Concurent/ESP32-Concurent.ino
mako777/modbus-esp8266
47904263660a07e8a24151ccd0679722d9b514d7
[ "BSD-3-Clause" ]
null
null
null
examples/RTU/ESP32-Concurent/ESP32-Concurent.ino
mako777/modbus-esp8266
47904263660a07e8a24151ccd0679722d9b514d7
[ "BSD-3-Clause" ]
0
null
null
/* ModbusRTU ESP32 Concurent thread example (c)2020 Alexander Emelianov (a.m.emelianov@gmail.com) https://github.com/emelianov/modbus-esp8266 Tool Modbus Slave on PC for test https://www.modbustools.com/download.html */ #include <ModbusRTU.h> #define REG 0 #define REG_NUM 32 #define SLAVE_ID1 51 #define SLAVE_ID2 52 #define MBUS_HW_SERIAL Serial1 #define MBUS_TXD_PIN 16 #define MBUS_RXD_PIN 35 ModbusRTU mb; xSemaphoreHandle xMutex; Modbus::ResultCode err; Modbus::ResultCode readSync(uint8_t address, uint16_t start, uint16_t num, uint16_t* buf) { xSemaphoreTake(xMutex, portMAX_DELAY); if (mb.slave()) { xSemaphoreGive(xMutex); return Modbus::EX_GENERAL_FAILURE; } Serial.printf("SlaveID: %d Hreg %d\r\n", address, start); mb.readIreg(address, start, buf, num, [](Modbus::ResultCode event, uint16_t, void*) { err = event; return true; }); while (mb.slave()) { vTaskDelay(1); mb.task(); } Modbus::ResultCode res = err; xSemaphoreGive(xMutex); return res; } void loop1( void * pvParameters ); void loop2( void * pvParameters ); void setup() { Serial.begin(115200); MBUS_HW_SERIAL.begin(9600, SERIAL_8N1, MBUS_RXD_PIN, MBUS_TXD_PIN); mb.begin(&MBUS_HW_SERIAL); mb.master(); xMutex = xSemaphoreCreateMutex(); xTaskCreatePinnedToCore( loop1, /* Task function. */ "Task1", /* name of task. */ 10000, /* Stack size of task */ NULL, /* parameter of the task */ 10, /* priority of the task */ NULL, /* Task handle to keep track of created task */ 0); /* pin task to core 1 */ xTaskCreatePinnedToCore( loop2, /* Task function. */ "Task1", /* name of task. */ 10000, /* Stack size of task */ NULL, /* parameter of the task */ 1, /* priority of the task */ NULL, /* Task handle to keep track of created task */ 1); /* pin task to core 1 */ } uint16_t hregs1[REG_NUM]; void loop1( void * pvParameters ){ while(true) { delay(10); if (readSync(SLAVE_ID1, REG, REG_NUM, hregs1) == Modbus::EX_SUCCESS) Serial.println("OK 2"); else Serial.println("Error 2"); } } uint16_t hregs2[REG_NUM]; void loop2( void * pvParameters ){ while(true) { delay(100); if (readSync(SLAVE_ID2, REG, REG_NUM, hregs2) == Modbus::EX_SUCCESS) Serial.println("OK 2"); else Serial.println("Error 2"); } } void loop() { delay(100); }
27.118812
91
0.576488
true
751