-
You Reply: [quote="Hector"]
[font=arial][size=small]The switch lets you choose between 5V supplied from the MEGA or an external voltage provided through the power terminal. The power terminal is unregulated voltage which is being supplied to the power pins on the expansion shield so if you connect 12Vdc to it you will effectively be providing 12Vdc to all the devices connected to those pins.[/size][/font]
[url=https://www.dfrobot.com/image/data/DFR0165/Mega_Expansion_shield_V21_SCH.pdf]https://www.dfrobot.com/image/data/DFR0165/Mega_Expansion_shield_V21_SCH.pdf[/url]
[/quote]
Sorry but i dont see the switch on the datasheet, can you tell me if i put 12v there which pins are getting 12v?
-
You Reply: nvm got it
-
You Reply: i kinda figure how to connect them.. I did:
Green to GND
Blue to VCC
Yellow to D4
White to D1
Tried this code:
[code]
const byte encoder0pinA = 2;//A pin -> 6
const byte encoder0pinB = 4;//B pin -> the digital pin 4
byte encoder0PinALast;
int duration;//the number of the pulses
boolean Direction;//the rotation direction
void setup()
{
Serial.begin(57600);//Initialize the serial port
EncoderInit();//Initialize the module
}
void loop()
{
Serial.print("Pulse:");
Serial.println(duration);
duration = 0;
delay(500);
}
void EncoderInit()
{
Direction = true;//default -> Forward
pinMode(encoder0pinB,INPUT);
attachInterrupt(0, wheelSpeed, CHANGE);
}
void wheelSpeed()
{
int Lstate = digitalRead(encoder0pinA);
if((encoder0PinALast == LOW) && Lstate==HIGH)
{
int val = digitalRead(encoder0pinB);
if(val == LOW && Direction)
{
Direction = false; //Reverse
}
else if(val == HIGH && !Direction)
{
Direction = true; //Forward
}
}
encoder0PinALast = Lstate;
if(!Direction) duration++;
else duration--;
}
[/code]
but the motors wont move...
-
You Reply: Note I have the new style of encoders wires: White, Yellow, Green, Blue
-
You Reply: any recommendation between f1 vs f2 connector?
-
You Reply: something like this: http://www.batterysupplier.com/i/2257/la1270-12v-7-0ah-sealed-lead-acid-battery-f1.htm ?