Сейчас ваша корзина пуста!
Katse 7.2
7.1 Katse Mootori kasutamine

nt switchPin = 2; // lüliti 1
int motor1Pin1 = 3; // viik 2 (L293D)
int motor1Pin2 = 4; // viik 7 (L293D)
int enablePin = 9; // viik 1(L293D)
void setup() {
// sisendid
pinMode(switchPin, INPUT);
//väljundid
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(enablePin, OUTPUT);
// aktiveeri mootor1
digitalWrite(enablePin, HIGH);
}
void loop() {
// kui lüliti on HIGH, siis liiguta mootorit ühes suunas:
if (digitalRead(switchPin) == HIGH)
{
digitalWrite(motor1Pin1, LOW); // viik 2 (L293D) LOW
digitalWrite(motor1Pin2, HIGH); // viik 7 (L293D) HIGH
}
// kui lüliti on LOW, siis liiguta mootorit teises suunas:
else
{ digitalWrite(motor1Pin1, HIGH); // viik 2 (L293D) HIGH
digitalWrite(motor1Pin2, LOW); // viik 7 (L293D) LOW
}
}

int switchPin = 2; // lüliti 1
int switchPin2 = 1; // lüliti 2
int potPin = A0; // potentsiomeeter
int motor1Pin1 = 3; // viik 2 (L293D)
int motor1Pin2 = 4; // viik 7 (L293D)
int enablePin = 9; // viik 1(L293D)
void setup() {
// sisendid
pinMode(switchPin, INPUT);
pinMode(switchPin2, INPUT);
//väljundid
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(enablePin, OUTPUT);
}
void loop() {
//mootori kiirus
int motorSpeed = analogRead(potPin);
//aktiveeri mootor
if (digitalRead(switchPin2) == HIGH)
{
analogWrite(enablePin, motorSpeed);
}
else
{ analogWrite(enablePin, 0); }
// kui lüliti on HIGH, siis liiguta mootorit ühes suunas:
if (digitalRead(switchPin) == HIGH)
{
digitalWrite(motor1Pin1, LOW); // viik 2 (L293D) LOW
digitalWrite(motor1Pin2, HIGH); // viik 7 (L293D) HIGH
}
// kui lüliti on LOW, siis liiguta mootorit teises suunas:
else
{
digitalWrite(motor1Pin1, HIGH); // viik 2 (L293D) HIGH
digitalWrite(motor1Pin2, LOW); // viik 7 (L293D) LOW
}
}
7.3 Katse Lihtne parkimissüsteem

#define ECHO_PIN 7
#define TRIG_PIN 8
int motorPin1=3;
int distance=1;
int LedPin=13;
int duration;
const int buzzerPin = 9;
void setup() {
pinMode(ECHO_PIN, INPUT);
pinMode(TRIG_PIN, OUTPUT);
pinMode(motorPin1,OUTPUT);
pinMode(LedPin,OUTPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(TRIG_PIN,LOW);
delay(200);
digitalWrite(TRIG_PIN,HIGH);
delay(200);
digitalWrite(TRIG_PIN,LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance=duration/58;
Serial.println(distance);
if (distance>50)
{
analogWrite(motorPin1,100);
digitalWrite(LedPin,0);
noTone(buzzerPin);
delay(1000);}
else
{
analogWrite(motorPin1,0);
digitalWrite(LedPin,250);
tone(buzzerPin, 1000);
}
}
Ülesanne 7.2 Iseliikuv auto.
Komponendid:
- 2 mootorit
- 2 lüliti
- 1 arduino plaat
- 1 distantsiandur
- 1 Motoori driver
- 1 Osakond patareidele
- 3 rattad
- 1 kokkupaneku alus
- 20 juhet
- 11 paari mutreid ja polte
- 4 patareid

https://drive.google.com/file/d/1pRlpD8B0dtjNZZ5bgXiB8hyr9ZUs7SJK/view?usp=sharing
//Robi v1.0
// Control of 2WD-1 robot platform using Arduino UNO.
// with obstacle avoidance using HC-SR04 ultra sonic sensor.
//SOFTWARE SERIAL FOR BLUETOOTH VARIABLES
//#include
//SoftwareSerial bluetoothSerial(12, 2); // RX, TX
//char bluetoothCommand;
//DISTANCE VARIABLES
const int trigPin = 3;
const int echoPin = 2;
int dist_check1, dist_check2, dist_check3;
long duration, distance, distance_all;
int dist_result;
//MOTORS VARIABLES
const int mot1f = 6;
const int mot1b = 5;
const int mot2f = 11;
const int mot2b = 10;
int mot_speed = 225; //motors speed
int k = 0; //BRAKE
//LOGICS VARIABLES
const int dist_stop = 25;
//const int dist_slow = 40;
const int max_range = 800;
const int min_range = 0;
int errorLED = 13;
//INITIALIZATION
void setup() {
// Serial.begin(9600);
// bluetoothSerial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(errorLED, OUTPUT);
}
//BASIC PROGRAM CYCLE
void loop() {
delay(1000);
goto start;
start:
int result = ping(); //Check distance
if (result max_range){ //Check max range
digitalWrite(errorLED, 1);
delay(500);
}
if (result == dist_stop || result dist_stop){ //If all is OK, go forward
motors_forward();
delay(100);
}
goto start;
}
////***********************FUNCTIONS*******************************\\\\
int ping(){ //CHECK DISTANCE FUNCTION (3x)
digitalWrite(trigPin, 0);
delayMicroseconds(2);
digitalWrite(trigPin, 1);
delayMicroseconds(10);
digitalWrite(trigPin, 0);
duration = pulseIn(echoPin, 1);
distance = duration/58;
dist_check1 = distance;
digitalWrite(trigPin, 0);
delayMicroseconds(2);
digitalWrite(trigPin, 1);
delayMicroseconds(10);
digitalWrite(trigPin, 0);
duration = pulseIn(echoPin, 1);
distance = duration/58;
dist_check2 = distance;
digitalWrite(trigPin, 0);
delayMicroseconds(2);
digitalWrite(trigPin, 1);
delayMicroseconds(10);
digitalWrite(trigPin, 0);
duration = pulseIn(echoPin, 1);
distance = duration/58;
dist_check3 = distance;
int dist_check_sum;
dist_check_sum = dist_check1 + dist_check2 + dist_check3;
dist_result = dist_check_sum/3;
return dist_result;
}
void motors_forward(){ //MOTORS FORWARD FUNCTION
analogWrite(mot1f, mot_speed);
analogWrite(mot2f, mot_speed);
digitalWrite(mot1b, 0);
digitalWrite(mot2b, 0);
}
void motors_back(){ //MOTORS BACK FUNCTION
digitalWrite(mot1f, 0);
digitalWrite(mot2f, 0);
analogWrite(mot1b, mot_speed);
analogWrite(mot2b, mot_speed);
}
void motors_stop() { //MOTORS STOP FUNCTION
digitalWrite(mot1f, 1);
digitalWrite(mot2f, 1);
digitalWrite(mot1b, 1);
digitalWrite(mot2b, 1);
}
void motors_left() { //MOTORS LEFT FUNCTION
analogWrite(mot1f, mot_speed);
digitalWrite(mot2f, 0);
digitalWrite(mot1b, 0);
analogWrite(mot2b, mot_speed);
}
void motors_right() { //MOTORS RIGHT FUNCTION
digitalWrite(mot1f, 0);
analogWrite(mot2f, mot_speed);
analogWrite(mot1b, mot_speed);
digitalWrite(mot2b, 0);
}
void motors_foward_left() { //FORWARD LEFT FUNCTION
k = mot_speed*0.8;
analogWrite(mot1f, mot_speed);
analogWrite(mot2f, k);
digitalWrite(mot1b, 0);
digitalWrite(mot2b, 0);
}
void motors_foward_right() { //FORWARD RIGHT FUNCTION
k = mot_speed*0.8;
analogWrite(mot1f, k);
analogWrite(mot2f, mot_speed);
analogWrite(mot1b, 0);
analogWrite(mot2b, 0);
}
void motors_back_left() { //BACK LEFT FUNCTION
k = mot_speed*0.8;
digitalWrite(mot1f, 0);
digitalWrite(mot2f, 0);
analogWrite(mot1b, k);
analogWrite(mot2b, mot_speed);
}
void motors_back_right() { //BACK RIGHT FUNCTION
k = mot_speed*0.8;
digitalWrite(mot1f, 0);
digitalWrite(mot2f, 0);
analogWrite(mot1b, mot_speed);
analogWrite(mot2b, k);
}
Tööpõhimõte:
Masin arduino tablool. töötab mootorisillaga seotud tasu arvelt, liigub kahe mootori arvelt, et tagumised rattad keerutavad. Esiosa ei ole mootoriga ühendatud, kuid see on šarniiril, tänu millele masin keerab. Ees asub kauguse andur, see määrab takistuse olemasolu, sellise olemasolu korral masin keerab. Saab toidet taga akuploki arvelt.
kasutamisvõimalused tavaelus.
Tööstus ja automatiseerimine: Mootorit kasutatakse konveierite, robotite, tööpinkide, transpordilintide ja muude seadmete ajamiseks. Need tagavad materjalide ja toodete täpse ja tõhusa liikumise.
Transport: Elektrimootoreid rakendatakse elektriautodes, elektriratastes ja teistes sõidukites. Need tagavad hääletu ja keskkonnasõbraliku energiaülekande.
Kodumasinad: Mootorit kasutatakse külmkappides, pesumasinates, ventilaatorites, kliimaseadmetes ja muudes kodumasinates.
Robootika: Mootorimehed on robotite, manipulaatorite ja droonide liikumiseks. Need võimaldavad robotitel täita mitmekesiseid ülesandeid.
Meditsiinitehnika: Meditsiinis kasutatakse mootorrattaid meditsiiniaparaatide, näiteks skannerite, infusioonpumpade jt ajamiseks.
Lennundus ja kosmos: Mootorrattureid rakendatakse lennukites, rakettides ja satelliitides kurvide, tõusude ja muude liikumiste juhtimiseks.
Elektroonika ja robootika hobideks: Mootorit kasutatakse entusiastide loodud mudelites, robotites, droonides ja muudes seadmetes.