jody
New Member
Posts: 7
|
Post by jody on Aug 5, 2014 13:32:55 GMT -8
The wiring diagrams for the Pi-Bot, really helped when assembling the Pi-Bot. This diagram was very helpful in getting my ultrasonic sensor working.
|
|
|
Post by 011235813 on Aug 5, 2014 16:07:34 GMT -8
Most STEM Board pins are taken. Digital pin 9 is the only vacant pin. You can also use analog pins. The important thing to keep in mind is that you need PWM pins (3, 5, 6 and 11) for motors.
|
|
jody
New Member
Posts: 7
|
Post by jody on Aug 5, 2014 16:46:26 GMT -8
I was a bit confused about the placement of wires onto the breadboard, the wiring terminology is all new to me. I was a bit confused about the added wiring needed for the advanced line following code, but I was able to figure it out.
I am currently using A0 analog pin, for the advanced line following code.
My next challenge is writing programs, I haven't done that yet.
|
|
AdvancedLineFollowing
Guest
|
Post by AdvancedLineFollowing on Aug 6, 2014 8:10:55 GMT -8
// AdvancedLineFollowing.ino
const int Line1 = 7; // Left Line Sensor const int Line2 = 8; // Center Line Sensor const int Line3 = 10; // Right Sensor
const int In1 = 3; // In1 const int In2 = 5; // In2 const int In3 = 6; // In3 const int In4 = 11; // In4 const int batPin = A0;
#define num 6
void setup() { // initialize the pins pinMode(In1, OUTPUT); pinMode(In2, OUTPUT); pinMode(In3, OUTPUT); pinMode(In4, OUTPUT); pinMode(Line1, INPUT); pinMode(Line2, INPUT); pinMode(Line3, INPUT); Serial.begin(9600); }
void loop() { int rLED[num], cLED[num], lLED[num]; int lSum, cSum, rSum; int fast; int speed1; int speed2; float scale1, scale2, scale3; boolean debugPrint; int L1, L2, L3; int batVoltage; for(int i=0; i<num; i++) { rLED=0; cLED=1; lLED=0; } rSum = 0; cSum = 0; lSum = 0; //************ Turn on debuging here **************** //debugPrint = true; debugPrint = false; //*************************************************** delay(100); forward(0, 0); while(1==1) { batVoltage = analogRead(batPin); L1 = digitalRead(Line1); L2 = digitalRead(Line2); L3 = digitalRead(Line3); if ((L1 == 1) && (L2 == 1) && (L3 ==1)) { speed1 = 0; speed2 = 0; forward(speed1, speed2); if(debugPrint) { Serial.println("In Lift Mode"); } } else if ((L1 != 0) || (L2 != 0) || (L3 !=0)) { rSum = 0; cSum = 0; lSum = 0; for(int i=0; i<num-1; i++) { rLED=rLED[i+1]; cLED=cLED[i+1]; lLED=lLED[i+1]; } rLED[num-1]=L1; cLED[num-1]=L2; lLED[num-1]=L3; for(int i=0; i<num; i++) { rSum = rSum + rLED * (8-i); cSum = cSum + cLED * (8-i); lSum = lSum + lLED * (8-i); } if(debugPrint) { Serial.println(""); Serial.print(L1); Serial.print(", "); Serial.print(L2); Serial.print(", "); Serial.println(L3); Serial.print(rSum); Serial.print(", "); Serial.print(cSum); Serial.print(", "); Serial.println(lSum); } scale1= (float) rSum + (float) cSum; scale2= (float) lSum + (float) cSum; scale3= (float) lSum + cSum + rSum;
fast= 80000. / (float) batVoltage; if(rSum > lSum) { speed1 = fast; speed2 = scale2/scale1 * fast; } else { speed2 = fast; speed1 = scale1/scale2 * fast; } forward(speed1, speed2); if(debugPrint) { Serial.print(scale1); Serial.print(", "); Serial.println(scale2); Serial.print(speed1); Serial.print(", "); Serial.println(speed2); Serial.print("battery Voltage = "); Serial.println(batVoltage); Serial.print("fast = "); Serial.println(speed2); delay(500); } } } }
void reverse(int speed1, int speed2) { analogWrite(In4, speed1); analogWrite(In3, 0); analogWrite(In2, speed2); analogWrite(In1, 0); return; }
void forward (int speed1, int speed2) { analogWrite(In4, 0); analogWrite(In3, speed1); analogWrite(In2, 0); analogWrite(In1, speed2); return; }
void stopNow() { analogWrite(In4, 0); analogWrite(In3, 0); analogWrite(In2, 0); analogWrite(In1, 0); return; }
|
|
jody
New Member
Posts: 7
|
Post by jody on Aug 6, 2014 10:10:23 GMT -8
Is there a wiring diagram, that includes the USS LED's and the added jumper for the advanced line following.
Terminology: Motor (H-Bridge) Controller - Refers to the Rectangular Electronic Chip (green) placed on the breadboard (mine is white).
|
|
jasea
Junior Member
Posts: 53
|
Post by jasea on Aug 9, 2014 11:12:26 GMT -8
jody, I have attached a breadboard and Schematic of the Ultrasound sensor connections. I can't add the link, as I can't find a part for the motor driver, but it goes from pin 15 of the motor driver, this is the pin that connects to the motor battery via the switch, ( see the diagram on page 2 of " Pi-Bot - Wiring and Programming Your Basic Pi-Bot.pdf" in the downloads section) to pin A0 on the Stem board. USS Breadboard.pdf (711.62 KB) USS Schematic.pdf (424.59 KB)
|
|
|
Post by MFinnerdruts on May 2, 2019 18:54:51 GMT -8
hi to all! give me plzase funny cats videoxs on yourtube
|
|
|
Post by MFinnerdruts on May 2, 2019 18:56:04 GMT -8
hi to all! give me plzase funny cats videoxs on yourtube
|
|
|
Post by MFinnerdruts on May 2, 2019 18:58:22 GMT -8
hi to all! give me plzase funny cats videoxs on yourtube
|
|
|
Post by MFinnerdruts on May 6, 2019 2:03:12 GMT -8
hi to all! give me plkase funny cats videods on yourtube
|
|
|
Post by MFinnerdruts on May 6, 2019 2:03:39 GMT -8
hi to all! give me plkase funny cats videods on yourtube
|
|
|
Post by MFinnerdruts on May 6, 2019 2:04:53 GMT -8
hi to all! give me plkase funny cats videods on yourtube
|
|
|
Post by MFinnerdruts on May 7, 2019 2:16:03 GMT -8
hi to all! give me plrase funny cats videozs on yourtube
|
|
|
Post by MFinnerdruts on May 7, 2019 2:16:37 GMT -8
hi to all! give me plrase funny cats videozs on yourtube
|
|
|
Post by MFinnerdruts on May 7, 2019 2:16:56 GMT -8
hi to all! give me plrase funny cats videozs on yourtube
|
|