SHARE
TWEET

Untitled

a guest Feb 27th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<SoftwareSerial.h>
  2.  
  3. #define Sen
  4. #define LM1 12 // левый двигатель
  5. #define LM2 5 // левый двигатель
  6. #define RM1 13 // правый двигатель
  7. #define RM2 6 // правый двигатель
  8.  
  9. SoftwareSerial mySerial(10, 11); // RX, TX
  10.  
  11. void setup() {
  12.   pinMode(Sen, INPUT);
  13.   pinMode(LM1, OUTPUT);
  14.   pinMode(LM2, OUTPUT);
  15.   pinMode(RM1, OUTPUT);
  16.   pinMode(RM2, OUTPUT);
  17. }
  18.  
  19. void loop() { // run over and over
  20.   if(digitalRead(Sen)){
  21.     digitalWrite(LM1, LOW);
  22.     digitalWrite(RM1, HIGH);
  23.     analogWrite(LM2, 0);
  24.     analogWrite(RM2, 0);
  25.   }
  26.   else{
  27.     digitalWrite(LM1, HIGH);
  28.     digitalWrite(RM1, LOW);
  29.     analogWrite(LM2, 0);
  30.     analogWrite(RM2, 0);
  31.   }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top