一、Arduino 介紹參考
入門講義 一
入門講義二
入門網頁 Cooper Maa
十種錯誤操作而毀壞Arduino的方式
關於超音波
入門網頁 Cooper Maa
進階說明 大學生專題報告
關於馬達驅動板
L298N Arduino擴充板
L298N 驅動板說明
概述 甲蟲工作室
L298N驅動板
http://arduino-info.wikispaces.com/MotorDrivers
本次接腳腳位
//Motor A
int dir1PinA = 13;
int dir2PinA = 12;
int speedPinA = 10;
//motor B
int dir1PinB = 11;
int dir2PinB = 8;
int speedPinB = 9;
範例說明
http://arduino-info.wikispaces.com/ArduinoShieldL298N
馬達驅動範例程式本次接腳腳位
//Motor A
int dir1PinA = 13;
int dir2PinA = 12;
int speedPinA = 10;
//motor B
int dir1PinB = 11;
int dir2PinB = 8;
int speedPinB = 9;
範例說明
http://arduino-info.wikispaces.com/ArduinoShieldL298N
S4A模組使用
範例檢測程式
整合
Arduino 遙控車設計與製作 曹永忠等著
Arduino 雙軸直流馬達控制 曹永忠等著
專題製作 參考
延伸讀
以超音波感測避障之順從式足型機器人
[用Android手機經Bluetooth遙控Arduino小車
作者已經移除這則留言。
回覆刪除超音波 + 馬達
回覆刪除// OTCarTest
// A simple test program for OTCar, will make the OTCar move forward, backward,
// turn right and turn left for specific seconds.
// http://www.osslab.com.tw/Hardware/Open_Embedded_System/MCU/AVR/Arduino/Remote_Car
/* Input for motorA:
IN1 IN2 Action
LOW LOW Motor Stop
HIGH LOW Motor moves forward
LOW HIGH Motor moves backward
HIGH HIGH Motor Stop
*/
const int motorIn1 = 12;
const int motorIn2 = 13;
const int motorIn3 = 11;
const int motorIn4 = 8;
int speedPinA = 9;
int speedPinB = 10;
const int DELAY = 1000;
#include
#define TRIGGER_PIN 7
#define ECHO_PIN 6
Ultrasonic ultrasonic(TRIGGER_PIN, ECHO_PIN);
void setup()
{
pinMode(motorIn1, OUTPUT);
pinMode(motorIn2, OUTPUT);
pinMode(motorIn3, OUTPUT);
pinMode(motorIn4, OUTPUT);
pinMode(speedPinA, OUTPUT);
pinMode(speedPinB, OUTPUT);
Serial.begin(9600);
}
void loop()
{
analogWrite (speedPinA, 255);
analogWrite (speedPinB, 255);
float cmMsec, inMsec;
long microsec = ultrasonic.timing();
cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
inMsec = ultrasonic.convert(microsec, Ultrasonic::IN);
Serial.print("MS: ");
Serial.print(microsec);
Serial.print(", CM: ");
Serial.print(cmMsec);
Serial.print(", IN: ");
Serial.println(inMsec);
delay(1000);
//selfTest();
}
void selfTest()
{
forward();
delay(DELAY);
motorstop(); delay(500);
backward();
delay(DELAY);
motorstop(); delay(500);
right();
delay(DELAY);
motorstop(); delay(500);
left();
delay(DELAY);
motorstop(); delay(500);
}
void motorstop()
{
digitalWrite(motorIn1, LOW);
digitalWrite(motorIn2, LOW);
digitalWrite(motorIn3, LOW);
digitalWrite(motorIn4, LOW);
}
void forward()
{
digitalWrite(motorIn1, HIGH);
digitalWrite(motorIn2, LOW);
digitalWrite(motorIn3, HIGH);
digitalWrite(motorIn4, LOW);
}
void backward()
{
digitalWrite(motorIn1, LOW);
digitalWrite(motorIn2, HIGH);
digitalWrite(motorIn3, LOW);
digitalWrite(motorIn4, HIGH);
}
// Let right motor keep running, but stop left motor
void right()
{
digitalWrite(motorIn1, HIGH);
digitalWrite(motorIn2, LOW);
digitalWrite(motorIn3, LOW);
digitalWrite(motorIn4, LOW);
}
// Let left motor keep running, but stop right motor
void left()
{
digitalWrite(motorIn1, LOW);
digitalWrite(motorIn2, LOW);
digitalWrite(motorIn3, HIGH);
digitalWrite(motorIn4, LOW);
}
需要
回覆刪除#include '小於' Ultrasonic.h '大於'
接近小於 10公分 停止
回覆刪除void loop()
{
analogWrite (speedPinA, 255);
analogWrite (speedPinB, 255);
float cmMsec, inMsec;
long microsec = ultrasonic.timing();
cmMsec = ultrasonic.convert(microsec, Ultrasonic::CM);
// inMsec = ultrasonic.convert(microsec, Ultrasonic::IN);
// Serial.print("MS: ");
// Serial.print(microsec);
Serial.print(", CM: ");
Serial.print(cmMsec);
// Serial.print(", IN: ");
// Serial.println(inMsec);
if (cmMsec < 10) {
motorstop();
}
else
{
forward();
}
delay(1000);
}
老師可以傳你買ARDUINO的網紙嗎?
回覆刪除不知到要買哪種?我想要藍牙版的~
回覆刪除上 露天拍賣
刪除打 "Arduino 車" 就可以找到 一堆
我大部分是跟 (微控制器科技) kiwiapple77的賣場 周先生購買
#include '小於' Ultrasonic.h '大於'
回覆刪除不能加錯地方