I made something like that, but with an ADFruit LED strip.(Didn't want to kill someone...)
Basicly it communicates to the computer by serial, recieving info like bullet velocity, direction of fire esc., and using Trajectory calculations to calculate the amount of degrees that it should aim to hit the target...
Problem is it only promps the first line. ie "Enter Password:"
Thus I cant see if my calculations are correct...
it is really funny @ 0:45 when you shoot the patriots right up ... think the real one has some safety for that trajectory
Also the speed of firing explains why the defence budget is so BIG
Firstly, I would like to formally welcome ECHELON to this thread...
Theres a few Patriots at an old military base near my house, old military tech is pretty cool. It cost so much to ship everything out, that they just left most of the stuff where it sat. There's still vehicles on the tarmac and fire trucks in the garage, desks still have non-classified papers on them.
Ok... So, what you are saying is that I'm trying to read ASCII Characters instead of Integers??
And that I should put quotes around the 1024??
I was asking you how you are sending the data to the Arduino. If it is via the Serial Monitor, then it arrives at the Arduino as ASCII data - one character at a time. "1024" is NOT one character. '1024' is, but you can't send that value via the Serial Monitor.
isn't that checking if there is data available??
Yes, but that is not what you have. What you have is:
// while(Serial.available() > 0);{
The wait for there to be serial data to read statement is commented out. That { is not needed, and, even it it was shouldnotbejammedupagainstthestatementlikethat.
Isn't this supposed to be a place where I can ask for help??
You would read "1024" as 4 separate characters. Each digit comes in s-l-o-w-l-y compared to Arduino speed. You need to check that all the digits come in (perhaps at least 1) and that not too many digits come in (at most 4?) and that a separator byte follows the digits (maybe a comma or linefeed or space, you decide) and that nothing but digits and separator come in (because the world is not perfect, errors happen).
You can read the characters into a char array (C string please, not C++ String!) and add a terminating zero then use atoi() to turn that into a number or.....
You can set an int to zero and as you get each digit (checking limits, etc as above) multiply the int x 10 then add the ASCII digit you read minus '0' (so '0' - '0' = 0 to '9' - '0' = 9).
How it works:
byte digit; // I will read serial bytes into this
int total = 0; // I will build the result in this
// I read '1' from serial into digit
total *= 10; // multiplies total * 10 and stores that into total, first time is 0 x 10 = 0
total += digit - '0'; // total now = 1
// I loop around, checking for digits and not over-length and with the rest, "024" total becomes;
// 1 x 10 + '0' - '0' = 10 + 0 = 10
// 10 x 10 + '2' - '0' = 100 + 2 = 102
// 102 x 10 + '4' - '0' = 1020 + 4 = 1024
If I read the separator after 1 or more digits I leave the loop and my result is in total.
If anything is wrong, I leave the loop with a variable set indicating error and result is bad.
Is that enough for you to code with? You can go either way.
For me, code is like the old puzzle games we had before hand calculators and PC's were around.
It can be a lot of fun and challenge, but once you add deadlines the fun and games are over.