Components and supplies
RobotGeek Small Solenoid
Arduino Mini 05
Stepper Motor
Project description
Code
chars.h
c_cpp
1const byte chars[][8] = 2{ 3{ 0, 0, 63, 68, 68, 68, 63, 0 }, 4{ 0, 0, 127, 73, 73, 73, 6, 0 }, 5{ 0, 0, 127, 73, 73, 73, 54, 0 }, 6{ 0, 0, 127, 64, 64, 64, 0, 0 }, 7{ 0, 3, 62, 66, 66, 62, 3, 0 }, 8{ 0, 0, 127, 73, 73, 73, 0, 0 }, 9{ 0, 99, 20, 8, 127, 8, 20, 99 }, 10{ 0, 0, 73, 73, 73, 54, 0, 0 }, 11{ 0, 127, 2, 4, 8, 16, 127, 0 }, 12{ 0, 127, 2, 100, 72, 16, 127, 0 }, 13{ 0, 0, 127, 8, 8, 20, 99, 0 }, 14{ 0, 0, 31, 32, 64, 64, 127, 0 }, 15{ 0, 127, 64, 48, 8, 48, 64, 127 }, 16{ 0, 0, 127, 8, 8, 8, 127, 0 }, 17{ 0, 0, 62, 65, 65, 65, 62, 0 }, 18{ 0, 0, 127, 64, 64, 64, 127, 0 }, 19{ 0, 0, 127, 68, 68, 68, 56, 0 }, 20{ 0, 0, 62, 65, 65, 65, 0, 0 }, 21{ 0, 0, 64, 64, 127, 64, 64, 0 }, 22{ 0, 0, 113, 9, 9, 9, 126, 0 }, 23{ 0, 56, 68, 68, 127, 68, 68, 56 }, 24{ 0, 0, 99, 20, 8, 20, 99, 0 }, 25{ 0, 0, 126, 2, 2, 2, 127, 1 }, 26{ 0, 0, 120, 8, 8, 127, 0, 0 }, 27{ 0, 127, 1, 1, 31, 1, 1, 127 }, 28{ 0, 126, 2, 2, 62, 2, 3, 127 }, 29{ 0, 64, 64, 127, 9, 9, 9, 6 }, 30{ 0, 127, 9, 9, 9, 6, 0, 127 }, 31{ 0, 0, 127, 9, 9, 9, 6, 0 }, 32{ 0, 0, 65, 65, 73, 73, 62, 0 }, 33{ 0, 127, 8, 62, 65, 65, 65, 62 }, 34{ 0, 0, 51, 76, 72, 72, 127, 0 }, 35{ 0, 0, 0, 0, 0, 0, 0, 0 }, 36{ 0, 0, 125, 0, 0, 0, 0, 0 }, 37{ 0, 0, 0, 48, 0, 48, 0, 0 }, 38{ 0, 0, 18, 63, 18, 18, 63, 18 }, 39{ 0, 0, 50, 73, 127, 73, 38, 0 }, 40{ 0, 32, 81, 38, 8, 50, 69, 2 }, 41{ 0, 0, 54, 85, 73, 69, 34, 5 }, 42{ 0, 0, 0, 64, 112, 0, 0, 0 }, 43{ 0, 0, 0, 62, 65, 0, 0, 0 }, 44{ 0, 0, 0, 0, 65, 62, 0, 0 }, 45{ 0, 0, 42, 28, 8, 28, 42, 0 }, 46{ 0, 0, 8, 8, 62, 8, 8, 0 }, 47{ 0, 0, 0, 5, 6, 0, 0, 0 }, 48{ 0, 0, 8, 8, 8, 8, 8, 0 }, 49{ 0, 0, 3, 3, 0, 0, 0, 0 }, 50{ 0, 0, 1, 6, 8, 48, 64, 0 }, 51{ 0, 0, 62, 69, 73, 81, 62, 0 }, 52{ 0, 0, 0, 33, 127, 1, 0, 0 }, 53{ 0, 0, 35, 69, 73, 49, 0, 0 }, 54{ 0, 0, 73, 73, 73, 54, 0, 0 }, 55{ 0, 0, 120, 8, 8, 127, 8, 0 }, 56{ 0, 0, 0, 121, 73, 73, 70, 0 }, 57{ 0, 0, 62, 73, 73, 73, 6, 0 }, 58{ 0, 0, 0, 67, 68, 72, 112, 0 }, 59{ 0, 0, 54, 73, 73, 73, 54, 0 }, 60{ 0, 0, 48, 73, 73, 73, 62, 0 }, 61{ 0, 0, 0, 36, 36, 0, 0, 0 }, 62{ 0, 0, 37, 38, 0, 0, 0, 0 }, 63{ 0, 0, 8, 20, 34, 0, 0, 0 }, 64{ 0, 0, 18, 18, 18, 18, 18, 0 }, 65{ 0, 0, 0, 0, 34, 20, 8, 0 }, 66{ 0, 0, 0, 64, 77, 72, 48, 0 }, 67{ 0, 0, 62, 65, 93, 85, 60, 0 }, 68{ 0, 0, 63, 68, 68, 68, 63, 0 }, 69{ 0, 0, 127, 73, 73, 73, 54, 0 }, 70{ 0, 0, 62, 65, 65, 65, 0, 0 }, 71{ 0, 0, 127, 65, 65, 65, 62, 0 }, 72{ 0, 0, 127, 73, 73, 73, 0, 0 }, 73{ 0, 0, 127, 72, 72, 72, 0, 0 }, 74{ 0, 0, 62, 65, 73, 73, 14, 0 }, 75{ 0, 0, 127, 8, 8, 8, 127, 0 }, 76{ 0, 0, 0, 65, 127, 65, 0, 0 }, 77{ 0, 0, 0, 65, 65, 126, 0, 0 }, 78{ 0, 0, 127, 8, 8, 20, 99, 0 }, 79{ 0, 0, 127, 1, 1, 1, 0, 0 }, 80{ 0, 127, 64, 48, 8, 48, 64, 127 }, 81{ 0, 0, 127, 32, 28, 2, 127, 0 }, 82{ 0, 0, 62, 65, 65, 65, 62, 0 }, 83{ 0, 0, 127, 68, 68, 68, 56, 0 }, 84{ 0, 0, 62, 65, 65, 71, 63, 1 }, 85{ 0, 0, 127, 72, 72, 76, 51, 0 }, 86{ 0, 0, 48, 73, 73, 73, 6, 0 }, 87{ 0, 0, 64, 64, 127, 64, 64, 0 }, 88{ 0, 0, 126, 1, 1, 1, 126, 0 }, 89{ 0, 0, 124, 2, 1, 2, 124, 0 }, 90{ 0, 120, 6, 1, 14, 1, 6, 120 }, 91{ 0, 0, 99, 20, 8, 20, 99, 0 }, 92{ 0, 0, 96, 16, 15, 16, 96, 0 }, 93{ 0, 0, 67, 69, 73, 113, 0, 0 }, 94{ 0, 0, 127, 65, 65, 0, 0, 0 }, 95{ 0, 0, 0, 112, 8, 7, 0, 0 }, 96{ 0, 0, 0, 65, 65, 127, 0, 0 }, 97{ 0, 0, 48, 64, 48, 0, 0, 0 }, 98{ 0, 0, 1, 1, 1, 1, 1, 0 }, 99{ 0, 0, 64, 48, 0, 0, 0, 0 }, 100{ 0, 0, 6, 41, 41, 41, 31, 0 }, 101{ 0, 0, 127, 9, 9, 9, 6, 0 }, 102{ 0, 0, 14, 17, 17, 17, 0, 0 }, 103{ 0, 0, 6, 9, 9, 9, 127, 0 }, 104{ 0, 0, 30, 37, 37, 37, 25, 0 }, 105{ 0, 0, 8, 63, 72, 72, 0, 0 }, 106{ 0, 0, 25, 37, 37, 37, 30, 0 }, 107{ 0, 0, 127, 8, 8, 8, 7, 0 }, 108{ 0, 0, 0, 0, 47, 0, 0, 0 }, 109{ 0, 0, 1, 1, 94, 0, 0, 0 }, 110{ 0, 0, 127, 4, 4, 27, 0, 0 }, 111{ 0, 0, 0, 64, 127, 0, 0, 0 }, 112{ 0, 15, 16, 16, 15, 16, 16, 15 }, 113{ 0, 0, 31, 16, 16, 16, 15, 0 }, 114{ 0, 0, 14, 17, 17, 17, 14, 0 }, 115{ 0, 0, 63, 72, 72, 48, 0, 0 }, 116{ 0, 0, 24, 36, 36, 31, 0, 0 }, 117{ 0, 0, 15, 16, 16, 8, 0, 0 }, 118{ 0, 0, 8, 21, 21, 21, 2, 0 }, 119{ 0, 0, 0, 8, 31, 9, 0, 0 }, 120{ 0, 0, 30, 1, 1, 1, 31, 0 }, 121{ 0, 0, 28, 2, 1, 2, 28, 0 }, 122{ 0, 30, 1, 2, 4, 2, 1, 30 }, 123{ 0, 0, 17, 10, 4, 10, 17, 0 }, 124{ 0, 0, 0, 25, 5, 5, 30, 0 }, 125{ 0, 0, 19, 21, 21, 25, 0, 0 }, 126{ 0, 0, 8, 54, 65, 0, 0, 0 }, 127{ 0, 0, 0, 0, 119, 0, 0, 0 }, 128{ 0, 0, 0, 0, 65, 54, 8, 0 }, 129{ 0, 8, 16, 16, 8, 4, 4, 8 }, 130{ 0, 0, 0, 0, 0, 0, 0, 0 } 131}; 132
telegraph.h
c_cpp
1#include <SoftwareSerial.h> 2 3#include <Servo.h> 4#include <Stepper.h> 5#include 6 "chars.h" 7 8 9// 10#define SERVO_PIN 2 11#define DOT_PIN 8 12#define 13 STEPPER_PIN 3 14 15// , 16#define DOT_UP_DELAY 30 17#define DOT_DOWN_DELAY 18 20 19 20// 21#define SERVO_MIN 140 22#define SERVO_MAX 180 23 24// . 25 , 26// SERVO_MAX-SERVO_MIN 27#define SERVO_STEPS 20 28 29 30#define 31 SERVO_STEP (SERVO_MAX - SERVO_MIN) / SERVO_STEPS 32 33//, 34#define 35 SERVO_DELAY SERVO_STEP*5 36 37 38#define STEPPER_STEP 600/SERVO_STEPS 39 40// 41 42#define LINE_TAB 10 43 44Servo servo; // 45Stepper 46 stepper(4096, 3, 4, 5, 6); // 47SoftwareSerial Bluetooth(A3, A2); // [RX, TX] 48 bluetooth- 49 50void setup() { 51 Bluetooth.begin(9600); 52 53 servo.attach(SERVO_PIN); 54 55 pinMode(DOT_PIN, OUTPUT); 56 stepper.setSpeed(4); 57 58 59 printString("HELLO"); 60} 61 62// 63 64void ping() { 65 digitalWrite(DOT_PIN, 1); 66 delay(DOT_UP_DELAY); 67 68 digitalWrite(DOT_PIN, 0); 69 delay(DOT_DOWN_DELAY); 70} 71 72int pos = 0; 73void 74 dot(int m) { 75 if(m) { 76 pos = 1; 77 digitalWrite(DOT_PIN, 1); 78 delay(DOT_UP_DELAY); 79 80 } else { 81 pos = 0; 82 digitalWrite(DOT_PIN, 0); 83 delay(DOT_DOWN_DELAY); 84 85 } 86} 87// 8 , 88// 89void printLine(int b) { 90 // 91 92 servo.write(SERVO_MAX - (LINE_TAB-2)*SERVO_STEP); 93 94 // , , 95 // 96 , 97 if(b != 0) { 98 servo.write(SERVO_MAX - (LINE_TAB-2)*SERVO_STEP); 99 100 delay(SERVO_DELAY*20); 101 102 // 103 for (int j = 0; b != 0; j++) 104 { 105 dot(b&1); 106 b >>= 1; 107 108 servo.write(SERVO_MAX 109 - (LINE_TAB+j)*SERVO_STEP); 110 delay(SERVO_DELAY); 111 } 112 113 dot(0); 114 115 } 116 117 // , 118 stepper.step(15); 119} 120 121// , 122// printLine() 123void 124 printChar(char c) { 125int n = 0; 126 127 for (int i = 0; i < 8; i++) { 128 if(chars[c][i] 129 != 0) { 130 printLine(chars[c][i]); 131 n++; 132 } 133 else stepper.step(11); 134 135 } 136} 137 138// , 139// printChar() 140void printString(char* str) { 141 142 while(*str != '\\0') { 143 printChar(*str); 144 str+=1; 145 } 146} 147 148int 149 n; 150 151void loop() { 152 // , - bluetooth, , 153 if(Bluetooth.available() 154 > 0) { 155 while(Bluetooth.available() > 0) { 156 n = Bluetooth.read(); 157 158 if(n >= 0) printChar((char)n); 159 } 160 } 161 // , 162 //, 163 164 Bluetooth.write(1); 165 delay(1500); 166} 167
telegraph.h
c_cpp
1#include <SoftwareSerial.h> 2 3#include <Servo.h> 4#include <Stepper.h> 5#include "chars.h" 6 7 8// 9#define SERVO_PIN 2 10#define DOT_PIN 8 11#define STEPPER_PIN 3 12 13// , 14#define DOT_UP_DELAY 30 15#define DOT_DOWN_DELAY 20 16 17// 18#define SERVO_MIN 140 19#define SERVO_MAX 180 20 21// . , 22// SERVO_MAX-SERVO_MIN 23#define SERVO_STEPS 20 24 25 26#define SERVO_STEP (SERVO_MAX - SERVO_MIN) / SERVO_STEPS 27 28//, 29#define SERVO_DELAY SERVO_STEP*5 30 31 32#define STEPPER_STEP 600/SERVO_STEPS 33 34// 35#define LINE_TAB 10 36 37Servo servo; // 38Stepper stepper(4096, 3, 4, 5, 6); // 39SoftwareSerial Bluetooth(A3, A2); // [RX, TX] bluetooth- 40 41void setup() { 42 Bluetooth.begin(9600); 43 44 servo.attach(SERVO_PIN); 45 pinMode(DOT_PIN, OUTPUT); 46 stepper.setSpeed(4); 47 48 49 printString("HELLO"); 50} 51 52// 53void ping() { 54 digitalWrite(DOT_PIN, 1); 55 delay(DOT_UP_DELAY); 56 digitalWrite(DOT_PIN, 0); 57 delay(DOT_DOWN_DELAY); 58} 59 60int pos = 0; 61void dot(int m) { 62 if(m) { 63 pos = 1; 64 digitalWrite(DOT_PIN, 1); 65 delay(DOT_UP_DELAY); 66 } else { 67 pos = 0; 68 digitalWrite(DOT_PIN, 0); 69 delay(DOT_DOWN_DELAY); 70 } 71} 72// 8 , 73// 74void printLine(int b) { 75 // 76 servo.write(SERVO_MAX - (LINE_TAB-2)*SERVO_STEP); 77 78 // , , 79 // , 80 if(b != 0) { 81 servo.write(SERVO_MAX - (LINE_TAB-2)*SERVO_STEP); 82 delay(SERVO_DELAY*20); 83 84 // 85 for (int j = 0; b != 0; j++) { 86 dot(b&1); 87 b >>= 1; 88 89 servo.write(SERVO_MAX - (LINE_TAB+j)*SERVO_STEP); 90 delay(SERVO_DELAY); 91 } 92 93 dot(0); 94 } 95 96 // , 97 stepper.step(15); 98} 99 100// , 101// printLine() 102void printChar(char c) { 103int n = 0; 104 105 for (int i = 0; i < 8; i++) { 106 if(chars[c][i] != 0) { 107 printLine(chars[c][i]); 108 n++; 109 } 110 else stepper.step(11); 111 } 112} 113 114// , 115// printChar() 116void printString(char* str) { 117 while(*str != '\\0') { 118 printChar(*str); 119 str+=1; 120 } 121} 122 123int n; 124 125void loop() { 126 // , - bluetooth, , 127 if(Bluetooth.available() > 0) { 128 while(Bluetooth.available() > 0) { 129 n = Bluetooth.read(); 130 if(n >= 0) printChar((char)n); 131 } 132 } 133 // , 134 //, 135 Bluetooth.write(1); 136 delay(1500); 137} 138
Downloadable files
sch_NAvmAmHuGu.jpg
sch_NAvmAmHuGu.jpg
sch_NAvmAmHuGu.jpg
sch_NAvmAmHuGu.jpg
Comments
Only logged in users can leave comments
Yegor_A
0 Followers
•0 Projects
Table of contents
Intro
64
0