Show Posts
Pages: [1] 2 3 ... 116
1  Using Arduino / Programming Questions / Re: Create voltage function that varies with time on: Today at 10:01:37 am
I have just started looking at your code but a few things spring to mind:
- which Arduino are you using?
- This line is confusing:
Code:
const int analogOutPin = DAC0;  // Analog input pin that the potentiometer is attached to
obviously you are using it as an output, so why the comment?
- on most Arduinos, 'double' is the same as 'float' so if you're expecting/need double precision, you aren't getting it.

More later
Pete
@gardner. The asin is correct in this case. It is generating a triangle wave.
2  Using Arduino / Programming Questions / Re: Create voltage function that varies with time on: October 01, 2014, 03:39:31 pm
What is phi? When I change that to pi, this version does plot a triangle.
Now that you have an equation that works, you can start converting it to work on an Arduino. Start by working the correct equation into the Arduino code you had before and then post it here.

Pete

3  Using Arduino / Programming Questions / Re: Create voltage function that varies with time on: October 01, 2014, 10:24:22 am
That produces the same error.

Pete
4  Using Arduino / Programming Questions / Re: error: expected unqualified-id before numeric constant on: October 01, 2014, 10:19:20 am
Code:
// DVD \\
A backslash at the end of a line is a continuation character. In this case you continue the comment onto the next line and make a mess of whatever follows. Remove the backslashes at the end of the comments.

Pete
5  Using Arduino / Programming Questions / Re: Create voltage function that varies with time on: September 30, 2014, 10:40:48 pm
Your Matlab code has a syntax error.
I fixed it and, as I suspected, your equation does not generate a triangle wave - it generates a sine wave. So please explain how "in matlab, it works perfectly".

Pete
6  Using Arduino / Programming Questions / Re: Create voltage function that varies with time on: September 30, 2014, 04:34:18 pm
Quote
When I graph my equation in matlab, it works perfectly.
In that case, post your entire matlab code here so that it can be verified and then it might be worthwhile trying to figure out where you are going wrong.

Pete
7  Using Arduino / Programming Questions / Re: map controller on: September 29, 2014, 03:41:24 pm
I think it should be this:
Code:
  int val_ry = map((ps2x.Analog(PSS_RY), DEC), 0, 255, 0, 180);

Pete
8  Using Arduino / Project Guidance / Re: Is Teensy the answer for video processing ? on: September 29, 2014, 02:31:10 pm
[ignore - brain not in gear]
Pete
9  Using Arduino / Project Guidance / Re: Is Teensy the answer for video processing ? on: September 29, 2014, 10:50:28 am
Of the 4 Teensies available, the 3.1 has the largest amount of flash and sram:
https://www.pjrc.com/teensy/
[edit+] Whether there is sufficient ram is dependent on what sort of video processing you intend to do.

What do you mean by SD? The way you mention it suggests that you don't mean a Secure Digital card.


Pete
10  Using Arduino / Programming Questions / Re: Using the pow() function?? on: September 29, 2014, 09:43:09 am
Doesn't matter. Errors in this function are independent of the libraries.
Code:
int setMotorSensitivity()
{
 float gamma = 1.5;
for (x=0; x<256; x++)
{
   float normx = x / 255.0;
   float normy = pow (normx, gamma);
   int y = (int) (0.5 + normy * 255);

   serial.print("x: ");
   serial.print(x, DEC);
   serial.print("   y: ");
   serial.println(y, DEC);
}
 
}

Pete
11  Using Arduino / Programming Questions / Re: Using the pow() function?? on: September 29, 2014, 09:32:30 am
Your code doesn't even compile.

Pete
12  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01+ Arduino Mega Problem.... on: September 27, 2014, 05:35:48 pm
If you have wired the Mega as described in the page you linked, then you need to change the receiving Mega's code from:
Code:
#define CSN_PIN 10
to
Code:
#define CSN_PIN 53

Pete
13  Using Arduino / Networking, Protocols, and Devices / Re: NRF24L01+ Arduino Mega Problem.... on: September 27, 2014, 04:36:51 pm
The Mega has the SPI pins on pins 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS).
Even if you've wired it up correctly, your posted code for the Mega is still specifying pins 9 and 10.

Pete
14  Using Arduino / Audio / Re: Sample 2s of audio, store FFT profile / 0.1 s, reproduce a 'similar' sound later on: September 27, 2014, 12:08:02 pm
You still haven't stated the most important piece of information - what sampling rate do you think you're going to use, or equivalently, what is the highest frequency you want to be able to reproduce?
A sampling rate of 8kHz would give you audio up to about 4kHz but 0.1sec sampled at 8kHz is 1600 bytes. Even if your estimate of 600 bytes for storing the results of each FFT is correct, you won't be able to store those results and the samples for 0.1sec in the available sram and still be able to do an FFT.

Pete
15  Community / Website and Forum / Re: Website problems 25/26 Sept 2014 ??? on: September 26, 2014, 05:08:02 pm
I haven't (usually) had hour-long delays but it does seem to be specific to the Arduino forum pages because while waiting for an Arduino page to load I can browse other sites without any delay at all. I use Firefox. Haven't tried other browsers.

Pete
Pages: [1] 2 3 ... 116