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

First time coder needs help!!
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

First time coder needs help!!

by ehearty on Wed Feb 12, 2020 2:26 am

Kinda a long post, sorry...
I'm a 17 year old in high school who is trying to get into to coding, and am trying to get some advice (not trying to get someone else to do work for me, just a push in the right direction). I'm trying to make a automatic goal counter, so that when the ball breaks the plane of sensors, ONE LED will light up (games are first to three, so 3 LED's on the goal post). In order to dictate when the ball breaks the goal line, I am using two sets of Ada fruit 5mm break beam sensors, spaced out so the ball cant get through the goal line without being sensed by at least one of the sensors. Essentially what I'm trying to code is a program that, when the beam is broken for the sensor, one LED will light up, and stay lit up until the score is reset by turning off power. I would also want to try and figure out how to make it so that after a goal is scored, there is a 5-6 second pause in the sensors so that the player can retrieve the ball from the goal without counting it as another goal. Just for so more info on the goals, they are 24" long and 12" tall, and I am using a futsal ball to play with (just a really small soccer ball). I'm making a set of these, but want each goal to be independent of each other. I know that was long, but just to recap, I'm trying to figure out a code that when the break beam sensors beam is broken, it will turn on an LED and turn off the sensors for 6-7 seconds so the person can retrieve the ball. As far as parts go, I have an arduino uno, breadboards, bunch of jump wires, a power source, and a GIANT starter kit with just about anything that I could want. I'm also using just basic arduino to code that I downloaded off their site (version 1.8.10). Please, any and all help appreciated, I have absolutely zero knowledge of coding and really need a push in the right direction.

ehearty
 
Posts: 8
Joined: Tue Jan 07, 2020 12:49 am

Re: First time coder needs help!!

by adafruit_support_bill on Wed Feb 12, 2020 8:30 am

I'd start by getting your break-beam sensors mounted on your goals and start testing them out using the example code in the guide: https://learn.adafruit.com/ir-breakbeam ... s/overview

Once you have that working, you can start expanding that code to handle your scoring and timing functionality

Lesson 2 shows how to control LEDs for your scoring display: https://learn.adafruit.com/adafruit-ard ... son-2-leds.

And get to know the millis() function. That will be useful for implementing the timing: https://www.arduino.cc/reference/en/lan ... me/millis/

adafruit_support_bill
 
Posts: 78954
Joined: Sat Feb 07, 2009 10:11 am

Re: First time coder needs help!!

by kcl1s on Wed Feb 12, 2020 9:07 am

I'm a 17 year old in high school who is trying to get into to coding

I have absolutely zero knowledge of coding and really need a push in the right direction.

First you need the basics. Learn about loops, conditionals and variables. Code.org Hour of Code will get you started. I have my students do Minecraft Adventurer https://code.org/minecraft then move into the Express course at the top of this page. https://code.org/student/middle-high
I have an arduino uno, breadboards, bunch of jump wires, a power source, and a GIANT starter kit with just about anything that I could want.

Once you know the basics you can transition to the Arduino language. Adafruit has this great tutorial that will work with your Uno kit (the Metro 328 is an Uno compatible) https://learn.adafruit.com/experimenters-guide-for-metro You will have to keep all the commas, semicolons, curly brackets and parenthesis straight but the concepts are the same. The whole guide is great. Get at least the basics up through circ01 and look at circ07 as your sensors will work a lot like button switches. You will learn about delay() so you can 'pause' the sensors for retrieving the ball. Work out a plan for your code in words then make it into code. Test and repeat until you get what you want.

Hope this helps

Fellow hobbyist
Keith

kcl1s
 
Posts: 1511
Joined: Tue Aug 30, 2016 12:06 pm

Please be positive and constructive with your questions and comments.


cron