Opis
Opis izdelka:
To je eno najcenejših in najnovejših robotov s sestavljivimi bloki (LEGO kompatibilno) in krmiljenjem gibanja vozila z programabilnim Arduino krmilnikom. Primeren je za mlade (7+) in odrasle. Glede na to, da je model LEGO in Arduino kompatibilen so nadgradnje in razširitve neomejene.
Splošna navodila:
Navodila za sestavljanje:
Program za vozilo:
Primer programa za premikanje vozila naprej-nazaj:
// Define the control pins of the L298N module
#define ENA 3
#define ENB 9
#define IN1 4
#define IN2 5
#define IN3 6
#define IN4 7
// Set the speed function
int speed_A = 180;
int speed_B = 180;
// put your setup code here, to run once:
void setup() {
Serial.begin(9600);
pinMode(IN1,OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3,OUTPUT);
pinMode(IN4,OUTPUT);
pinMode(ENA,OUTPUT);
pinMode(ENB,OUTPUT);
}
// put your main code here, to run repeatedly:
void loop() {
speed_adjust();
forward();
delay(2000);
back();
delay(2000);
}
// Speed adjustment
void speed_adjust()
{
analogWrite(ENA,speed_A);
analogWrite(ENB,speed_B);
}
//Forward function
void forward()
{
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
//Serial.println("Forward");
}
//Back function
void back()
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
//Serial.println("Back");
}
//Left turn function
void Left()
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
//Serial.println("Left");
}
//Right turn function
void Right()
{
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,HIGH);
digitalWrite(IN4,LOW);
//Serial.println("Right");
}
//Stop function
void STOP()
{
digitalWrite(IN1,LOW);
digitalWrite(IN2,LOW);
digitalWrite(IN3,LOW);
digitalWrite(IN4,LOW);
//Serial.println("STOP");
}