Where to even start with my project?

Hello all, I'm new here. I just wanted to say that the Arduino community seems really great and friendly so I look forward to learning my way around here.

The project that I'm making is supposed to be relatively simple. However, I'm still new to coding along with microprocessing.

Here's the goal:

I would like to write up a program that takes in an input (like a number) and then have it compute that input through the algorithm at which point, the program will spit out the correct output. Also, I should note that the (n + 1)th input is a function of the previous output. For example, say I put in an input 7 and it spits out 33.9. This output (33.9) limits the allowable inputs I can make next.

Really, the algorithm isn't important to understand. I'm making a mathematical machine that computes these numbers based off of a complicated function.

My real question here relates to the particular hardware.

I don't know a whole lot about microprocessing and microcontrollers. However, I do have the conceptual model to convey to you. It goes as follows.

Let there be 2 pieces of hardware involved. One transmits an input and the other receives the input and transmits back the correct output according to my code.

The part that transmits the input value has a button or two. Some combination of these buttons corresponds to an input. For example, let there be 2 buttons. One left (L) and one right (R). Let the combination (L)(R)(R)(L) correspond to the input 17.

The part that receives the input value 17 quickly computes the correct output according to my code and then it will send back this output to the transmitter through a series of vibrations. Let the time between vibrations be denoted by t. Through pattern recognition and such, I (At the transmitter's end) will receive the correct output value.


Okay so that about wraps it up. I apologize for being so detailed but again, I'm trying to build this mathematical model in terms of hardware. The last part where the output gets expressed as a vibration is really important since it technically has to do with oscillations and there is actually some Physics applications there that I won't get into here.

Also, as I've already said I'm still new to coding, let alone microprocessing so any help or guidance on where to start is vastly appreciated.

Thank you! :slight_smile:

Mariocortez100:
I would like to write up a program that takes in an input (like a number) and then have it compute that input through the algorithm at which point, the program will spit out the correct output.

IS the input a number? If it is NOT a number, what is it? If it is a number, what is the range of possible input numbers? Are the input numbers integers or floating-point? If floating point, how many decimal places? What is the range of output numbers?

Mariocortez100:
Also, I should note that the (n + 1)th input is a function of the previous output. For example, say I put in an input 7 and it spits out 33.9. This output (33.9) limits the allowable inputs I can make next.

What do you want to happen if the input is invalid? What restrictions are there on the FIRST input?

Mariocortez100:
Let there be 2 pieces of hardware involved.

WHY?!?

Mariocortez100:
The part that transmits the input value has a button or two. Some combination of these buttons corresponds to an input. For example, let there be 2 buttons. One left (L) and one right (R). Let the combination (L)(R)(R)(L) correspond to the input 17.

There will be some work to figure out how to map patterns of buttons to input values. Will there be a fixed number of button pushes? Will there be a time period of no button pushes that indicates the end of the input?

Mariocortez100:
The part that receives the input value 17 quickly computes the correct output according to my code and then it will send back this output to the transmitter through a series of vibrations. Let the time between vibrations be denoted by t. Through pattern recognition and such, I (At the transmitter's end) will receive the correct output value.

So this is a device to gain an edge in a casino. :slight_smile:

It looks quite easy to me. Connect your two buttons the the Arduino, see Debounce or StateChangeDetection examples for the related code. Output can be made by kind of a piezo buzzer, or some other electromagnetic feedback actuator (vibration motor...). Search the web for some device that matches your expectations.

I would like to write up a program that takes in an input (like a number) and then have it compute that input through the algorithm at which point, the program will spit out the correct output.

Input from where? Just 2 buttons? Output to where?

I'm trying to build this mathematical model in terms of hardware.

The Arduino (all microprocessors/microcontrollers) runs software.

It seems like a computer (or a smart phone) might be a better platform for your application. The Arduino is good for for dedicated applications with specialized hardware requirements... Measuring temperature, controlling the speed of a motor, etc. It doesn't have much processing power and it doesn't come with any kind of user interface.

Okay so that about wraps it up. I apologize for being so detailed but again

I'd say your description is rather vague. The only hardware you've described is "2 buttons"...

I don't know if you your algorithm is complicated or not. You will have to convert it to C/C++. Can you simulate it on a spreadsheet?

Vibration motors are available; use one of those for the output.

Buttons are available, use those for the input, see one of the countless articles on debouncing buttons in Arduino land.

Separate the functions, and use the serial monitor to validate that you have input working.

Then verify that you can generate output the way you want with the vibration motor, then combine the two.

When writing your mathematical algorithm, be aware of datatypes and how they impact how the compiler does math (particularly "type promotion", and the possibly counterintuitive matter of integer division).

You can wire a couple of buttons to an Ardino and then interpret a sequence of button presses to be a number. That should be relatively easy though you need to consider how easily a human operator will be able to press the buttons to correctly input the desired number.

You then want to transmit the number to a receiver. What you need to decide here is what physical medium you want to use for the transmission. There are lots of options. You could join the two devices with wire and use RS232 or Ethernet, you could use WiFi, you could use Infra Red.

Once the receiver gets the input number it can apply a formula and calculate a new number. You do need to consider though what happens if there is a transmission error i.e. can the receive ask the transmitter to send again and if it cannot will a faulty transmission cause things to get out of step.

Now you have the question of the receiver using "vibrations" to output the number it has calculated.
You need to decide exactly how the number is encoded into vibrations. For example you could send the number in binary as clicks or you could use different tones or amplitudes to send the number in some other base. You also need to consider how you would detect those vibrations. Again you also need to decide if you need some kind of handshaking and/or error detection/correction so that if the number is not received or incorrectly received this can be catered for.

I think for help you need to make some decisions and give people more information about the "vibrations".

I guess you have not heard of "good vibes" and "bad vibes"?

Paul