Help with project code?

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ScottieP
 
Posts: 3
Joined: Tue Sep 13, 2022 8:35 pm

Help with project code?

Post by ScottieP »

Howdy all,

I'm aiming to build a clock like this: https://learn.adafruit.com/trinket-powe ... clock/code and am trying to get the code on the Trinket, but keep getting errors that I don't understand. The error(s):
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Uno" (I've tried this with several boards- is there one specifically for Trinkets?)

/Users/admin/Documents/Arduino/sketch_sep07a/sketch_sep07a.ino: In function 'void PWM4_init()':
sketch_sep07a:77:3: error: 'TCCR1' was not declared in this scope
TCCR1 = _BV (CS10); // no prescaler
^~~~~
/Users/admin/Documents/Arduino/sketch_sep07a/sketch_sep07a.ino:77:3: note: suggested alternative: 'TCCR1A'
TCCR1 = _BV (CS10); // no prescaler
^~~~~
TCCR1A
In file included from /Users/admin/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include/avr/io.h:99:0,
from /Users/admin/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include/avr/pgmspace.h:90,
from /Users/admin/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/Arduino.h:28,
from sketch/sketch_sep07a.ino.cpp:1:
sketch_sep07a:78:31: error: 'PWM1B' was not declared in this scope
GTCCR = _BV (COM1B1) | _BV (PWM1B); // clear OC1B on compare
^
sketch_sep07a:80:3: error: 'OCR1C' was not declared in this scope
OCR1C = 255; // frequency
^~~~~
/Users/admin/Documents/Arduino/sketch_sep07a/sketch_sep07a.ino:80:3: note: suggested alternative: 'OCR1A'
OCR1C = 255; // frequency
^~~~~
OCR1A
exit status 1
'TCCR1' was not declared in this scope

These "not declared this scope" messages are stopping me cold. Can anyone help me make sense/get past this?

Thanks all,

Scott

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Help with project code?

Post by Franklin97355 »

You need to select the Trinket:
2022-09-13_17-54-59.jpg
2022-09-13_17-54-59.jpg (191.18 KiB) Viewed 156 times

User avatar
ScottieP
 
Posts: 3
Joined: Tue Sep 13, 2022 8:35 pm

Re: Help with project code?

Post by ScottieP »

Howdy Franklin,

Thank you! I'm looking at my boards manager and see that I have the SAMD and AVR boards installed, but not "Adafruit Boards". Is that in some special repository? Does it matter that I'm using Arduino 1.8.19, or that I'm on a Mac?

Cheers,

Scott

User avatar
sj_remington
 
Posts: 998
Joined: Mon Jul 27, 2020 4:51 pm

Re: Help with project code?

Post by sj_remington »

You need to go through the "getting started" tutorial with the Trinket, which includes installing the boards and drivers.
https://learn.adafruit.com/introducing-trinket

User avatar
ScottieP
 
Posts: 3
Joined: Tue Sep 13, 2022 8:35 pm

Re: Help with project code?

Post by ScottieP »

Update: I found https://github.com/arduino/Arduino/wiki ... pport-urls and the boards were there. I'm now able to verify. Thanks again Franklin!

Cheers,

Scott

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”