inventrdotio / AdventureKit2

Code for the second adventure kit
41 stars 12 forks source link

Day 4 IR_SmartLights does not compile #16

Closed sricheson closed 1 year ago

sricheson commented 1 year ago

IR_SmartLights does not compile. (Need a break; statement between lines 96 and 97 for the default: case.)

inetdavid commented 1 year ago

I'm working on this now, Sue. I've re-done the Fritzing and did the quick fix for the code, though the code needs a lot more cleanup. When I duplicated the circuit I noticed that when the red LED was on the blue didn't seem to make any change in color, even though the blue worked fine by itself. I modified the circuit to place the 220 ohm resistors on each color rather than the common ground and then I was able to get "purple" using both red and blue.

I'll probably make this into a three sketch solution. First sketch will read the IR code and display it to the serial console so that the buttons can be identified. The second sketch will be like the current one, turning each color on/off. For the third I thought perhaps I'd modify it so that each "up" code would increase the intensity of that color and each down would reduce the intensity.

Let me know your thoughts. I wanted to give you some quick feedback to let you know it's being worked on.

sricheson commented 1 year ago

Yes, I saw that I was not able to get blended colors also, so I dropped back to the component instructions for RGB LED and used the 3 resistors.

All worked well then.

I’m an ‘old hand’ retired from 40 years of firmware and software development. So I do these things for entertainment. But it might be

hard for a middle or high schooler unfamiliar with electronics and software to figure some of this stuff out by troubleshooting. That’s the

one thing I would recommend keeping in mind.

Going with a stepped approach is probably good. That’s leads them to get the codes from the remote so they can use them in the later sketch.

Again, I collected those codes first thing with the instructions for just the IR and remote components. (Interestingly they matched up with

another remote I’d gotten with a Hackerbox.)

Anyway, I think that stepped approach is the best for those just learning.

I’ll try out the new code when it’s posted.

Sue

From: David Schmidt @.> Sent: Saturday, June 17, 2023 12:56 PM To: inventrdotio/AdventureKit2 @.> Cc: Sue Richeson @.>; Author @.> Subject: Re: [inventrdotio/AdventureKit2] Day 4 IR_SmartLights does not compile (Issue #16)

I'm working on this now, Sue. I've re-done the Fritzing and did the quick fix for the code, though the code needs a lot more cleanup. When I duplicated the circuit I noticed that when the red LED was on the blue didn't seem to make any change in color, even though the blue worked fine by itself. I modified the circuit to place the 220 ohm resistors on each color rather than the common ground and then I was able to get "purple" using both red and blue.

I'll probably make this into a three sketch solution. First sketch will read the IR code and display it to the serial console so that the buttons can be identified. The second sketch will be like the current one, turning each color on/off. For the third I thought perhaps I'd modify it so that each "up" code would increase the intensity of that color and each down would reduce the intensity.

Let me know your thoughts. I wanted to give you some quick feedback to let you know it's being worked on.

— Reply to this email directly, view it on GitHub https://github.com/inventrdotio/AdventureKit2/issues/16#issuecomment-1595806182 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMX6GQCCT5MKRJ3YFA5VOTXLXOTRANCNFSM6AAAAAAZIB5MMQ . You are receiving this because you authored the thread.Message ID: @.***>

inetdavid commented 1 year ago

Yup, I'm a recently retired Sr. Software Engineer and when I played with the Adventure Kit I just had to start updating the code and sending it to the guys. They insisted on paying me (first in parts/pieces/kits) and now I'm back to working 20 hours/week (my limit). I just pushed up the first of the three sketches. This one does the command decodes and has a structure to add descriptions for recognized commands. Feel free to be VERY critical of code/comments. Goal is to be clear and good learning.

inetdavid commented 1 year ago

OK, more re-writing. Broke it into FOUR sketches, and I'm using ENUMS so I don't have to repeat the command codes in multiple places. Final sketch uses PWM to be able to change each color intensity in steps (which requires moving to different pins). Alex says he may just use the last sketch as we're so overloaded right now, but I still want the steps showing.

Check out the different versions and let me know what you think.

sricheson commented 1 year ago

I’ll check the sketches out Monday afternoon.

Thanks for reworking.

Keep middle and high schoolers as the target unless the target of Inventr.io is more experienced than that.

sue

From: David Schmidt @.> Sent: Sunday, June 18, 2023 8:30 PM To: inventrdotio/AdventureKit2 @.> Cc: Sue Richeson @.>; Author @.> Subject: Re: [inventrdotio/AdventureKit2] Day 4 IR_SmartLights does not compile (Issue #16)

OK, more re-writing. Broke it into FOUR sketches, and I'm using ENUMS so I don't have to repeat the command codes in multiple places. Final sketch uses PWM to be able to change each color intensity in steps (which requires moving to different pins). Alex says he may just use the last sketch as we're so overloaded right now, but I still want the steps showing.

Check out the different versions and let me know what you think.

— Reply to this email directly, view it on GitHub https://github.com/inventrdotio/AdventureKit2/issues/16#issuecomment-1596326166 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMX6GVP5QQXV6K2IZTX54TXL6MSFANCNFSM6AAAAAAZIB5MMQ . You are receiving this because you authored the thread.Message ID: @.***>

inetdavid commented 1 year ago

The good thing about these projects is that they're not primarily about coding, but I do want to teach good coding as we go. Many students will just copy/paste, but I want to give enough information for those that wish to learn more. You probably noticed this in the early lessons. This can conflict at times with the release schedule so Alex had to rush ahead with the latter lessons, and we're working on a complete refresh of the 30-Days course with new (professional) videos. So, AK2 may lag behind for a while. :-(

I'm having fun with these projects. Getting into electronics and BACK into C/C++ after leaving those behind 25+ years ago for Ruby, Ruby on Rails and later Swift (ending my career at Apple). I just deployed a new RoR app that will give us an API endpoint for our AK2 final lesson that includes allowing "survivors" to have a numbered pin (no names) added to a world map (rough location based on IP-> lat/long) so our survivors will see where others have completed the course.

Your input is appreciated, whether bugs or even pointing out places where my comments can be better.

inetdavid commented 1 year ago

I'll await your final comments before I close this ticket.

sricheson commented 1 year ago

Looks good! New png file looks good also. I tested it and checked out the serial monitor output. Looks much better. And I like all those code comments too.