美崙國中版本
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
一般的
2014年3月7日 星期五
2014年1月20日 星期一
自走車機器人自我檢查步驟
一、確認連接線
電源線 正負極性不可以接反
伺服機排線的正負極與信號不可以接反
二、確認超音波端子頭
確認超音波端子連接線是否接正確,正負極與TR、EC的連接。
三、接上USB端子。觀察電路工作狀態
四、啟動超音波程式,檢測超音波功能是否正確。
五、啟動伺服機控制程式
電源線 正負極性不可以接反
伺服機排線的正負極與信號不可以接反
二、確認超音波端子頭
確認超音波端子連接線是否接正確,正負極與TR、EC的連接。
三、接上USB端子。觀察電路工作狀態
四、啟動超音波程式,檢測超音波功能是否正確。
五、啟動伺服機控制程式
2013年12月21日 星期六
選手小車驅動
下載點
https://drive.google.com/file/d/0B_uh7-e5jDMcVHgwOHphNkFzeVk/edit?usp=sharing
伺服馬達校正
先使角度為 90度 再裝上超音波模組
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup()
{
myservo.attach(5); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(90); // sets the servo position according to the scaled value
delay(1500); // waits for the servo to get there
}
https://drive.google.com/file/d/0B_uh7-e5jDMcVHgwOHphNkFzeVk/edit?usp=sharing
伺服馬達校正
先使角度為 90度 再裝上超音波模組
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup()
{
myservo.attach(5); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(90); // sets the servo position according to the scaled value
delay(1500); // waits for the servo to get there
}
2013-12-21 花工假日樂活營課程
Arduino入門
範例一 閃爍燈:測試電路板
範例二 呼吸燈:學習 if
範例三 調控燈:學習類比輸入
範例四 霹靂燈:學習for 指令
任務一:結合範例一與二
任務二:結合範例三與四
使用網頁:
Cooper Maa
http://coopermaa2nd.blogspot.tw/2011/05/arduino.html
曹永忠老師網頁
http://www.cs.pu.edu.tw/~yctsao/indexdown.php
範例一 閃爍燈:測試電路板
範例二 呼吸燈:學習 if
範例三 調控燈:學習類比輸入
範例四 霹靂燈:學習for 指令
任務一:結合範例一與二
任務二:結合範例三與四
使用網頁:
Cooper Maa
http://coopermaa2nd.blogspot.tw/2011/05/arduino.html
曹永忠老師網頁
http://www.cs.pu.edu.tw/~yctsao/indexdown.php
2013年11月9日 星期六
自強國中課程程式一 6燈改9燈
/*
For Loop Iteration
Demonstrates the use of a for() loop.
Lights multiple LEDs in sequence, then in reverse.
The circuit:
* LEDs from pins 2 through 7 to ground
created 2006
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/ForLoop
*/
int timer = 200; // The higher the number, the slower the timing.
void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 2; thisPin < 11; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 11; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = 10; thisPin >= 2; thisPin--) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}
For Loop Iteration
Demonstrates the use of a for() loop.
Lights multiple LEDs in sequence, then in reverse.
The circuit:
* LEDs from pins 2 through 7 to ground
created 2006
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/ForLoop
*/
int timer = 200; // The higher the number, the slower the timing.
void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 2; thisPin < 11; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 11; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = 10; thisPin >= 2; thisPin--) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}
訂閱:
文章 (Atom)