When I upload it as it is, nothing seems to happen and nothing is output in the serial monitor. However when I remove this line from Measuring_speed.cpp
#include "Motor.h"
#include "PinChangeInt.h"
void Motor::Encoder_init() {
attachInterrupt(digitalPinToInterrupt(ENCODER_LEFT_A_PIN), EncoderCountLeftA, CHANGE);
// attachPinChangeInterrupt(ENCODER_RIGHT_A_PIN, EncoderCountRightA, CHANGE); // <-- this line
}
...
Then stuff starts to happen, wheels turn and there is output in the serial monitor. However (as expected) there are no values for the encoder on the right motor.
From a bit of digging I think it maybe something to do with the arduino nano only having interrupt on pin 2 and 3 so they had to use some library to deal with the right encoder on pin 4.
They are using the pinChange-Interrupt which can be used on more IO-pins than just 2 and 3
anyway If you have all parts from the kit and the demo-code does not work
send an email-request to elegoo with a detailed descriptionhow you setup everything and what results you get.
I have the same problem - even the Interrupt for Using the key on the board does not work. The PinChangeInt.h library seems to be very old. How to get a current version. Did you get the problem solved somehow? All in all I would be happy to get some information on programming the robot oneself - a little tutorial or other input.
und an allen Stellen an denen die Funktion attachPinChangeInterrupt auftaucht diese ersetzen:
//attachPinChangeInterrupt(ENCODER_RIGHT_A_PIN, encoderCountRightA, CHANGE);
// new Version with PinChangeInterrupt Library 1.2.9
attachPCINT(digitalPinToPCINT(ENCODER_RIGHT_A_PIN), encoderCountRightA, CHANGE);