Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

PWM on A1 & A2 ok but on A0?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PWM on A1 & A2 ok but on A0?

by V2man on Sun Nov 03, 2019 2:06 pm

I was playing with analog write to make PWM signals on A1 and A2 but when I try to analog write to A0 I get this error on my CPX. Starting Clockwise from the micro USB connector that becomes 9876543210 --> 0001011010 --> 0x05A. This code is not listed in https://makecode.com/js/errorcodes

What is the range on A0: 0 to 255?
What is the range on A1 & A2: 0 to 1023?
What am I doing wrong on A0?

I know I am using 256 x 4 in Makecode but it does not seem to matter.
I have tried maxcnt x gain = 255 x 4 and with gain = 1.
I still get an error on A0.

PWM_A0_ErrorOnCPX.JPG
PWM_A0_ErrorOnCPX.JPG (21.98 KiB) Viewed 167 times


PWMonA1A2.JPG
PWMonA1A2.JPG (84.29 KiB) Viewed 167 times
Attachments
circuitplayground-PWMA1A2.uf2
(282 KiB) Downloaded 8 times

V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: PWM on A1 & A2 ok but on A0?

by V2man on Sun Nov 03, 2019 7:32 pm

On the direction, function() I could not figure out how to add a num input variable without getting an error. It works without any num input.
What's the correct way to do this?

V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: PWM on A1 & A2 ok but on A0?

by V2man on Mon Nov 04, 2019 1:14 am

The function does work with num but is this the correct way?
functionNnum.JPG
functionNnum.JPG (29.79 KiB) Viewed 143 times

V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Please be positive and constructive with your questions and comments.