Posts

Showing posts from July, 2022

Drawing Bot

Image
 #include <Servo.h> #include <EEPROM.h> //Stepper1 #define IN11  6 #define IN12  7 #define IN13  8 #define IN14  9 //Stepper2 #define IN21  2 #define IN22  3 #define IN23  4 #define IN24  5 Servo servopen;   int steps = 0; int Steps1 = 0; int Steps2 = 0; int movealternate=0; double perdegree=15.95; //5750 double perstep=12; //4096 int rotatesteps; int movesteps; int recsteps; int uppos = 25; int downpos = 1; String penstatus="U"; int movepen; int servodelay=500; boolean Direction1 = false; boolean Direction2 = true; //dir1=1 dir2=0 goes backwards //dir1=1 dir2=1 turns right //dir1=0 dir2=0 turns left //dir1=0 dir2=1 goes forward unsigned long last_time; unsigned long currentMillis ; long time; String recstr = ""; String laststr = ""; String movec = "F"; String inputString; char Incomvalue; boolean stringComplete = false; String S1; String S2; String Splitstr; int Sstr1; int Sstr2; int findcomma; int previouscomma; boolean comp = true;

Code for ACCELEROMETER car

Image
 int xPin=A0; int yPin=A1; int out1=8;     //output1 for HT12E IC int out2=9;     //output1 for HT12E IC int out3=10;    //output1 for HT12E IC int out4=11;    //output1 for HT12E IC void setup(){   pinMode(xPin,INPUT);   pinMode(yPin,INPUT);   pinMode(out1,OUTPUT);   pinMode(out2,OUTPUT);   pinMode(out3,OUTPUT);   pinMode(out4,OUTPUT); } void loop()  {   int xval=analogRead(xPin);   int yval=analogRead(yPin);   if ((xval>294 && xval<340) && (yval>294 && yval<340)) //stop   {     digitalWrite(out1,LOW);       digitalWrite(out2,LOW);        digitalWrite(out3,LOW);        digitalWrite(out4,LOW);   }    else    {      if ((xval>340 && xval<380) && (yval>294 && yval<340)) //forward    {      digitalWrite(out1,HIGH);        digitalWrite(out2,LOW);         digitalWrite(out3,HIGH);        digitalWrite(out4,LOW);            }     if ((xval>345 && xval<294) && (yval>294 && yval<340)) //ba