Show Posts
|
|
Pages: 1 2 [3] 4 5 ... 48
|
|
32
|
Using Arduino / Project Guidance / Re: Magnetic rotary encoder Code
|
on: April 21, 2013, 05:02:22 pm
|
|
People will be more willing to help if you post the code you have written rather than expecting others to write it for you.
In case you don't know where to start: 1. You will need to sire up the sensor and verify that it works manually (ie, see the transition from 0-1) by either turning on a LED or writing to the serial display. 2. Once you have done this, then test it with the disk and see that you can detect when the disk rotates. Each time the transition from 0 to 1 (or 1 to 0) happens, then add count to some counter. 3. Once the counter reaches your required value, do whatevere you need (in this case turn on a LED).
All these smaller 'projects' are easy if you look for examples in this forum or on the web.
|
|
|
|
|
34
|
Using Arduino / Audio / Re: Using arduino to trigger sound (Need Help, Am Noob)
|
on: April 20, 2013, 04:02:36 pm
|
|
You will need to break this down into 2 parts: 1. Detect stuff with IR sensors. You need to get the sensors, witre them up and test to see that it all works. 2. Play sound. What type of sound will dictate the technology you need. Simple beeps can be done directly from the Arduino; playing MP3 will need specialised hardware.
The two are independent - the only connection is that when you detect you will play the sound.
If you want to plat the sound through big speakers you will probably also need an amplifier as the output levels from chips is not enough to drive something that big.
Hope this is a start. I think you should think about what you want to do first, then design the system around that.
|
|
|
|
|
35
|
Using Arduino / Programming Questions / Re: Serial.print() giving odd behaviour
|
on: April 20, 2013, 03:23:25 pm
|
|
Nothing is acting 'weird'. If you share the same serial connection you will see messages from everything that uses that connection. As I have already said several times, you cannot mix MIDI and serial debug on the same serial line and expect it the output to be 'clean'.
If you are just using this for debugging, then live with it and move on. Once you remove the debug statements all that will be left if the midi. If you mean to use this for information, then you need to find a different solution for the messages (LCD 4 line display, for example) that is separate.
|
|
|
|
|
37
|
Using Arduino / Programming Questions / Re: Serial.print() giving odd behaviour
|
on: April 20, 2013, 02:08:55 am
|
|
Maybe so, but the Arduino IDE must be getting the data to dsplay from somewhere any you only have one serial port open ..
Thge MIDi library is writing it's stuff to the serial port, same as Serial.print. What COM port is the Python script reading from and is this the same as the IDE?
It is far, far, far more likely that you have some error in the COM port config than there being a problem in the Serial.print library.
|
|
|
|
|
39
|
Using Arduino / Programming Questions / Re: Problems with loading and reading an array
|
on: April 18, 2013, 11:10:58 pm
|
which means some bits are going to slop all over the floor As I understand it the compiler will take care of the conversion when you are assigning the data like this. It is a cause of many 'errors' reported by novices in the forum. I agree that a cast would make it more explicit and clearer for the reader.
|
|
|
|
|
40
|
Using Arduino / Programming Questions / Re: Problems with loading and reading an array
|
on: April 18, 2013, 10:06:54 pm
|
The array is technically only being created and seeded one time at this point Technically yes, but once every 150 milliseconds because of your delay statement. Loop runs continuously (at the end it starts again). Every time through the array is remade on the stack. If you happen to be pressing the button at the time it will put random numbers in the array, which then disappears and is remade again (with what is on the stack at the time). It may be that you have some of the data from before, but you may not. When you press the second switch you print what is in the array, which could be rubbish. One easy way to check is to print the random numbers as they are put into the array. Another is to put the array as a global variable so it remains in scope between calls to loop().
|
|
|
|
|
44
|
Using Arduino / Programming Questions / Re: Problems with loading and reading an array
|
on: April 17, 2013, 10:47:53 pm
|
Fair enough, but I would think that you immediately save time, effort and debugging by doing this: CheckButton(uint8_t i) { if (btnState[i] != btnLastState[i]) { // I only want the state change and I don't want this to continue to loop while the button is still pressed if (btnState[i] == 1) { for (int i = 0; i < Level; i++) { // Testing to just see what was loaded in the array. Serial.println(rdmNum); } Serial.println(); Serial.println(sizeof(rdmNum)); // more testing about Array } } btnLastState[i] = btnState[i]; // Save the state so I can detect the change next time around }
and then not repeat the same lines of code all over the place with different variable names.
|
|
|
|
|