Welcome to the Robolink Community forum!
Arduino coding
-
I finished with my code of dc motors and now that I’m done an error popped up saying error TIMSK was not declared in the scope, can u help me out and tell what the problem is with my code? Also does motor 1 have to be the same as motor 3?
Here’s my code
https://create.arduino.cc/editor/tserluca/870a22d6-1b67-4afe-8852-928476292875/preview -
@tserluca Please check your email and be ready with your computer with a microphone. Thanks!
-
@robolink_leila r you guys gonna call me or do we call you and if we do what’s the phone number?
-
@robolink_leila Ok I did the steps and I put my code in codebender and it said upload was successful,but the motors are not running why is that?The website told me that it will work on Chromebook. Also I’m trying it on a hp computer and it’s still saying TIMSK is not declared in the scope and it’s saying the board is incorrect even tho it’s the right board.
-
-
@robolink_leila this is my first code that I’ve done in my life, so I don’t have another code.So what do I do now?If there’s no error why is it saying I have an error?(Is it because I’m on a Chromebook?)
-
@tserluca You can put another board with a third motor to control independently if you have one! As for the error, I haven't seen that error before. I compiled your code on my end and everything compiled correctly. Could you upload another code that has worked before and provide me with the OS and version that you are using?
-
@robolink_leila so i cant make M3 do something different than M1? Cause I have three motors and i want all them to do something different. Unless if i put motor 1 and 2 in one code sketch and upload it to a board and put motor 3 in another code sketch and download it to another board, can I do that?
Heres the error's
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp: In member function 'void SmartInventorClass::TVRemoconClose()':/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:38:59: error: 'TIMSK' was not declared in this scope
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:38:59: note: suggested alternative: 'TIMSK0'
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
TIMSK0
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp: In member function 'void SmartInventorClass::DCMotorClose()':
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:561:59: error: 'TIMSK' was not declared in this scope
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:561:59: note: suggested alternative: 'TIMSK0'
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
TIMSK0
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp: In member function 'void SmartInventorClass::RFRemoconClose()':
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:770:59: error: 'TIMSK' was not declared in this scope
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:770:59: note: suggested alternative: 'TIMSK0'
if(dcUse == 0 || remoconUseTV == 0 || remoconUseRF == 0) TIMSK |= (0<<TOIE2);
^~~~~
TIMSK0
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp: In member function 'void SmartInventorClass::Timer2Set()':
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:836:2: error: 'TIMSK' was not declared in this scope
TIMSK &= ~(1<<TOIE2);
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:836:2: note: suggested alternative: 'TIMSK0'
TIMSK &= ~(1<<TOIE2);
^~~~~
TIMSK0
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:837:2: error: 'TCCR2' was not declared in this scope
TCCR2 &= ~((1<<WGM21) | (1<<WGM20));
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:837:2: note: suggested alternative: 'TCCR2A'
TCCR2 &= ~((1<<WGM21) | (1<<WGM20));
^~~~~
TCCR2A
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:839:16: error: 'OCIE2' was not declared in this scope
TIMSK &= ~(1<<OCIE2);
^~~~~
/home/builder/opt/libraries/latest/rokitsmart_1_0_9/SmartInventor.cpp:839:16: note: suggested alternative: 'OCIE2B'
TIMSK &= ~(1<<OCIE2);
^~~~~
OCIE2B
exit status 1
-
@tserluca Sorry this got lost! This is actually a RokitSmart question
Motor 1 and Motor 3 are paired so they cannot be coded independently. A screenshot of the error would be really helpful