Posts

SIP CAR Code BLUETOOTH

 BLUETOOTH #define MAX_PACKETSIZE 32    //Serial receive buffer char buffUART[MAX_PACKETSIZE]; unsigned int buffUARTIndex = 0; unsigned long preUARTTick = 0; struct car_status{   int speed;   int angle;   int direct; }; int move_speed=100 ; #define MAX_SPEED  250 #define MIN_SPEED  50 #define TURN_SPEED  70 #define SLOW_TURN_SPEED  50 #define BACK_SPEED  60 int buttonState; char old_status='0'; #define speedPinR 9   //  RIGHT WHEEL PWM pin D45 connect front MODEL-X ENA  #define RightMotorDirPin1  22    //Front Right Motor direction pin 1 to Front MODEL-X IN1  (K1) #define RightMotorDirPin2  24   //Front Right Motor direction pin 2 to Front MODEL-X IN2   (K1)                                  #define LeftMotorDirPin1  26    //Left front Motor direction pin 1 to Front MODEL...

SIP CAR Code Ultra Sonic

 ULTRASONIC SENSOR #include <Servo.h> #define speedPinR 9   //  RIGHT WHEEL PWM pin D45 connect front MODEL-X ENA  #define RightMotorDirPin1  22    //Front Right Motor direction pin 1 to Front MODEL-X IN1  (K1) #define RightMotorDirPin2  24   //Front Right Motor direction pin 2 to Front MODEL-X IN2   (K1)                                  #define LeftMotorDirPin1  26    //Left front Motor direction pin 1 to Front MODEL-X IN3 (  K3) #define LeftMotorDirPin2  28   //Left front Motor direction pin 2 to Front MODEL-X IN4 (  K3) #define speedPinL 10   // Left WHEEL PWM pin D7 connect front MODEL-X ENB #define speedPinRB 11   //  RIGHT WHEEL PWM pin connect Back MODEL-X ENA  #define RightMotorDirPin1B  5    //Rear Right Motor direction pin 1 to Back MO...

SIP Car Code FBRL

 JugueBot Car Movement #define SPEED 100     #define TURN_SPEED 100     #define speedPinR 9   //  Front Wheel PWM pin connect Right MODEL-X ENA  #define RightMotorDirPin1  22    //Front Right Motor direction pin 1 to Right MODEL-X IN1  (K1) #define RightMotorDirPin2  24   //Front Right Motor direction pin 2 to Right MODEL-X IN2   (K1)                                  #define LeftMotorDirPin1  26    //Front Left Motor direction pin 1 to Right MODEL-X IN3 (K3) #define LeftMotorDirPin2  28   //Front Left Motor direction pin 2 to Right MODEL-X IN4 (K3) #define speedPinL 10   //  Front Wheel PWM pin connect Right MODEL-X ENB #define speedPinRB 11   //  Rear Wheel PWM pin connect Left MODEL-X ENA  #define RightMotorDirPin1B  5    //...

SIP Car Code Encoders

 JugueBot Code Wheel Encoders  #define outputA 6  #define outputB 7  int counter = 0;   int aState;  int aLastState;    void setup() {     pinMode (outputA,INPUT);    pinMode (outputB,INPUT);        Serial.begin (9600);    // Reads the initial state of the outputA    aLastState = digitalRead(outputA);     }   void loop() {     aState = digitalRead(outputA); // Reads the "current" state of the outputA    // If the previous and the current state of the outputA are different, that means a Pulse has occured    if (aState != aLastState){           // If the outputB state is different to the outputA state, that means the encoder is rotating clockwise      if (digitalRead(outputB) != aState) {         counter ++;      } else {   ...

Larson Scanner

Image
 Larson Scanner

Ultra Sonic Sensor

 Ultra Sonic Sensor Code int trigPin = 12; /* Trig pin of the sensor is connected to the 6th pin of Arduino */ int echoPin = 11;  /* The echo pin of the sensor is connected to the 7th Pin of the Arduino */ long Duration; //Duration   long Distance; //Distance   int leftMotor_1=3;  //motor 1 the first data entry is HIGH OR LOW int leftMotor_2=2;  //motor 1 the second data entry is HIGH OR LOW int rightMotor_1=4; //motor 2 the first data entry is HIGH OR LOW int rightMotor_2=5; //motor 2 the second data entry is HIGH OR LOW int leftMotor_pwm=6;  // motor 1 Speed ​​control is done with pwm input for                       // 0-255 analog PWM signal is sent in range int rightMotor_pwm=9; // motor 2 Speed ​​control is done with pwm input for                        // 0-255 analog PWM signal is sent in range void setup() {   for(in...

IR Car Remote

 IR Car Remote Code #include <IRremote.h> int RECV_PIN = 11; IRrecv myIrrecv(RECV_PIN); decode_results results; //Init Motors const int PWM_M1 = 5; const int IN1_M1 = 2; const int IN2_M1 = 3; const int PWM_M2 = 6; const int IN1_M2 = 8; const int IN2_M2 = 9; int speed = 100; void setup(){   Serial.begin(9600);   myIrrecv.enableIRIn();      pinMode(PWM_M1,OUTPUT);   pinMode(PWM_M2,OUTPUT);      pinMode(IN1_M1,OUTPUT);   pinMode(IN2_M1,OUTPUT);      pinMode(IN1_M2,OUTPUT);   pinMode(IN2_M2,OUTPUT); } void loop(){   if (myIrrecv.decode(&results)){                 switch(results.value){           case 0xFD00FF: //power           break;           case 0xFD807F://vol+             forward();           break;         ...