-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no A0 #4
Comments
Arduino Uno is an ATMega328, and we have the 3 ports port B {8,9,10,11,12,13,-1,-1}, the A0 must be pin 14 and so on... |
do i need to add a interrupt to the code if i have pcint.h? |
you need a function to be called by the interrupt just, after that your function will be called whenever the pin CHANGEs state |
when i go to upload the code, i get In file included from C:\Users\taran\Documents\Arduino\sketch_may02a\sketch_may02a.ino:1:0: C:\Users\taran\Documents\Arduino\libraries\PCINT-master\src/pcint.h:50:5: warning: #warning using maps! [-Wcpp]
C:\Users\taran\Documents\Arduino\libraries\PCINT-master\src/pcint.h:53:113: warning: narrowing conversion of '-1' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing]
C:\Users\taran\Documents\Arduino\libraries\PCINT-master\src/pcint.h:53:113: warning: narrowing conversion of '-1' from 'int' to 'const uint8_t {aka const unsigned char}' inside { } [-Wnarrowing] C:\Users\taran\Documents\Arduino\sketch_may02a\sketch_may02a.ino: In function 'void setup()': sketch_may02a:15: error: no matching function for call to 'PCattachInterrupt(int&, int)' PCattachInterrupt<14>(mydiceFunction,CHANGE);
C:\Users\taran\Documents\Arduino\sketch_may02a\sketch_may02a.ino:15:44: note: candidate is: In file included from C:\Users\taran\Documents\Arduino\sketch_may02a\sketch_may02a.ino:1:0: C:\Users\taran\Documents\Arduino\libraries\PCINT-master\src/pcint.h:103:7: note: template void PCattachInterrupt(mixHandler, uint8_t) void PCattachInterrupt(HANDLER_TYPE userFunc, uint8_t mode) {
C:\Users\taran\Documents\Arduino\libraries\PCINT-master\src/pcint.h:103:7: note: template argument deduction/substitution failed: C:\Users\taran\Documents\Arduino\sketch_may02a\sketch_may02a.ino:15:44: note: cannot convert 'mydiceFunction' (type 'int') to type 'mixHandler' PCattachInterrupt<14>(mydiceFunction,CHANGE);
exit status 1 and do i need |
it seems that you are passing an can you run the example? |
yes i can |
so void mydiceFunction() {
//... do somestuff here
} |
do i put the if(digitalRead(buttonPin) == 0 && lastButtonState == 1); //if button is pressed and was released last change else if(digitalRead(buttonPin) == 1 && lastButtonState == 0) //if button is not pressed, and was pressed last change { lastButtonState = 1; //record the lastButtonState |
you can use RISING or FALLING instead of CHANGE, if you are interested on a particular edge, its safer then checking state P.S. still if interested on both edges you only need to check current state, then you know it changes from the inverse (no need to store the last state) |
do i put in the void mydicefunction randNumber = random(1, 7);
Serial.println(randNumber); or if(digitalRead(buttonPin) == 0 && lastButtonState == 1); //if button is pressed and was released last change else if(digitalRead(buttonPin) == 1 && lastButtonState == 0) //if button is not pressed, and was pressed last change
{
lastButtonState = 1; //record the lastButtonState and i have the mydicefunction change and when i go to upload the code to the arduino, it comes up with a compiling error and it doesn.t do that with any other code, plz help |
i think that you should add the arduino uno and add pins A0 to A5 (like on the arduino uno)
The text was updated successfully, but these errors were encountered: