we should have required you to clearly define what you need.
then had you refine that
then refine that.
(we are often too quick to offer answers to questions that are not clear.)
by the time you could logically describe what you are looking for, you would have been able to find the answers.
I keep telling my son that if you understand the question. every word in the question, with full conceptual understanding.
then you also know the answer.
if you cannot figure out the question, you can only guess.
dave-in-nj:
looking back, I think we let you down.
I'm not at all sure about that. There were 4 pages of stuff in the other Thread - a lot of people made an effort.
The two sides of the coin are teaching and learning. The student (assuming he wants to learn and is not just attending class because he can't find any more windows to break) has an obligation as much as the teacher has.
In my experience the most useful thing a student can say is "I don't understand" rather than (as is more common - especially in adults) pretending to understand for fear of looking stupid. (And if you want some fun it can also be a great way of exposing the teacher's pitiful knowledge)
Ok so I can't upload pictures because my phone gets no service in school but I can use this computer to post online. So basically I have 5 rows with red dot lasers on one side that point to light sensors on the other side. And I also have 5 columns setup the same way with red dot lasers and sensors. This basically makes a 5 by 5 grid and the objective is for someone to place there finger or object on the grid and disrupt a row and column. Basically they interrupt the row and column by block the red dot laser from hitting the sensor. When they do in fact disrupt a row and column it turns on a corresponding LED. Hope that makes better sense. I have a basic flow chart I can put here that might make more sense. I'm trying to do a function to scan the rows and then when a row is interrupted it scans the columns and when a column is also interrupted it will find out which row and collumn is interrupted and light up a corresponding led.
Here is the link for the basic flowchart I created. Lucidchart
The question is do you guys think this project is too complicated for a beginner in arduino. I honestly like the idea of having 3 buttons. One for the row and you hit it either 1 to 5 times to indicate which row(for example hit the row button 3 times to go to row 3) and then do the same for the column and hit send when you want that light to stay lit. Just wondering if that would be more easier to do for a beginner like me.
The question is do you guys think this project is too complicated for a beginner in arduino.
No, not at all.
You were already able to get two sensors to cross and turn on the LED when both were blocked, so now you need to add a second laser and be able to turn on a second LED and so on.
To cycle through all the lasers, you can use two FOR loops. In the end we might have you change them to IF statements, but for now FOR loops will work.
for(byte col = 0; col < 4; col++)
{
for(byte row = 0; row < 4; row++)
{
if( laser_C[ col ] == LOW && laser_R[ row] == LOW)
{
//LED @ (col, row) = HIGH
// You can latch them on and off here too.
}
}// end of row for loop
}//end of col for loop
You might need a delay or a line of code that checks to see if the lasers are continuously being block, and so to ignore them until their states change.
In your other thread, you said your lasers were dimming. Did you go back and read the response I gave you, to fix that?
Hazards Mind the thing was with the lasers my new partner and my teacher were talking bout how the coding may be easier especially because u helped me with the first 1 by 1 light up, the problem is that the hardware would just be very difficult just building the box and precisely cutting all the lasers and sensors. My teach said he liked the button idea (he thought about that a long time ago just didn't tell me so I would learn the hard way). My idea is having 5 buttons that go up and down so that each button is used for a certain row. Then have 5 buttons in a row on the bottom and each button is assigned to a column. I'll draw it up so u guys could understand but if you guys could let me know if this could work out that be great.
Basically the code kinda works. It's random like sometimes I'll press the buttons and the light wont turn on.
Also I kinda wanted to implement a send button which I have no idea how to do. So if I hit the button B and then the button 1 the led for B1 would only light up if I hit the send button. That way it can keep the led b1 on and reset the button states for button b and 1. Anybody catch me on that idea?
Btw I am using 3 buttons, The B column button and the Row 1 and Row 2 button so I'm trying to turn on the B1 or B2 Led at my command of hitting the right combination of buttons.
const int ledPinB1 = 13;
const int ledPinB2 = 12;
const int ledPinI1 = 11;
const int ledPinI2 = 10;
const int buttonPin1 = A0;
const int buttonPin2 = A1;
const int buttonPinB = A2;
const int buttonPinI = A3;
// Variables will change:
int buttonPushCounter1 = 0;
int buttonState1 = 0;
int lastButtonState1 = 0;
int buttonPushCounter2 = 0;
int buttonState2 = 0;
int lastButtonState2 = 0;
int buttonPushCounterB = 0;
int buttonStateB = 0;
int lastButtonStateB = 0;
int buttonPushCounterI = 0;
int buttonStateI = 0;
int lastButtoneStateI = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
buttonPush1();
buttonPush2();
buttonPushB();
if (buttonPushCounter1 % 2 == 1 && buttonPushCounterB % 2 == 1) {
digitalWrite(ledPinB1, HIGH);
} else {
digitalWrite(ledPinB1, LOW);
}
if (buttonPushCounter2 % 2 == 1 && buttonPushCounterB % 2 == 1) {
digitalWrite(ledPinB2, HIGH);
} else {
digitalWrite(ledPinB2, LOW);
}
}
void buttonPush1() {
buttonState1 = digitalRead(buttonPin1);
if (buttonState1 != lastButtonState1) {
if (buttonState1 == HIGH) {
buttonPushCounter1 ++;
}
else {
Serial.println("off");
}
}
lastButtonState1 = buttonState1;
}
void buttonPushB() {
buttonStateB = digitalRead(buttonPinB);
if (buttonStateB != lastButtonStateB) {
if (buttonStateB == HIGH) {
buttonPushCounterB ++;
}
else {
Serial.println("off");
}
}
}
void buttonPush2() {
buttonState2 = digitalRead(buttonPin2);
if (buttonState2 != lastButtonState2) {
if (buttonState2 == HIGH) {
buttonPushCounter2 ++;
}
else {
Serial.println("off");
}
}
}