Show Posts
Pages: 1 2 [3] 4 5 ... 110
31  Using Arduino / Displays / Re: LCD Screen Displaying Random Characters on: March 19, 2014, 04:33:15 pm
I'm afraid that I have to say that the soldering of the pin headers is not very good. There are several pins which look like they could be cold solder joints which would explain the intermittent problems.

You need to use a little more solder on some of the joints, and on all of them leave the soldering iron on the joint for longer - maybe ~5 or so seconds of heat on each join after you have applied the solder to give it time to flow onto the pads.
32  Using Arduino / Programming Questions / Re: regarding loop function on: March 18, 2014, 08:47:52 pm
I think you need to move this line into loop() to update the display.
Code:
display.display();
33  Using Arduino / Programming Questions / Re: regarding loop function on: March 18, 2014, 08:13:43 pm
You don't need to call 'loop()' from setup().
Code:
loop(); //not needed
34  Using Arduino / Displays / Re: LCD Screen Displaying Random Characters on: March 18, 2014, 08:11:07 pm
Loose connection. Check all your wires.
35  Using Arduino / Programming Questions / Re: Why doesn't this SD.open method work? on: March 15, 2014, 07:14:33 pm
This is wrong:
Code:
sizeof(dataFileName)

For the 'String' class (which you should be avoiding like the plague), you should use:

Code:
dataFileName.length();


This is also wrong:
Code:
dataFileName.toCharArray(__dataFileName, sizeof(__dataFileName) + 1);
It should be:
Code:
dataFileName.toCharArray(__dataFileName, sizeof(__dataFileName));
36  Using Arduino / Displays / Re: Need pointing in the right direction (TFT diplay) on: March 15, 2014, 06:15:42 am
The TFT Library is based on this:
https://github.com/adafruit/Adafruit-ST7735-Library

Which if you read says that it is designed for "1.8" Displays". Presumably very specific displays at that.

Don't expect all TFT displays to be made equal.
37  Using Arduino / Programming Questions / Re: Custom class... WHAT? on: March 15, 2014, 06:04:16 am
A slight tweak should do it.

Code:
void setup() {
    memcpy( sequence[0].distance, distanceInitialiser, sizeof(distanceInitialiser) );
    memcpy( sequence[0].rotation ,rotationInitialiser, sizeof(rotationInitialiser) );
}

Good catch, that's what I meant, just forgot to remove the [10]'s having copied and pasted from the OPs earlier post.
38  Using Arduino / Programming Questions / Re: Ultrasound Sensor on: March 14, 2014, 07:28:31 pm
Code:
String strOne =  String(distance, DEC);
     char dist[6];
     strOne.toCharArray(dist, 6); //converts string to char array
What a horrible way of doing it...

Abandon the String class and do something like this:
Code:
char dist[6];
sprintf(dist,"%d",distance);
39  Using Arduino / General Electronics / Re: Does size matters? :$ on: March 14, 2014, 07:22:58 pm
0402 coming along? I've been using them for over a year as a hobbyist, and they have been on motherboards and in phones for ages and ages.
The latest ones are as small as 0201, and even more impressive, 01005.

The different sizes are governed by several factors:
(1) power - high power means larger size required, so power circuitry tends to use the larger sizes
(2) speed - if you are talking about several GHz, everything behaves like RF signals whipping around in traces. A large physical size component is a massive burden on high-f design.
(3) space - if you have, say, a 64bit data bus and all of the lines need decoupling and terminating, there is simply not enough space to use a large size component - I've found in circuits I've designed in the past for HDMI, that even finding room for 0402 terminations in a tight space is not easy - no chance of fitting 0603 or above.
(4) cost - smaller components mean less real estate on the board = smaller board sizes = more functionality at lower cost.

In fact in many areas now if you look in a smart-phone for example, discrete RLC components are getting fewer and far between. Most of those that would have been there are now being integrated onto the silicon die in custom ASICs - have you ever tried to find datasheets for the ICs on a modern phone - many you never will as they are custom ICs.
40  Using Arduino / Programming Questions / Re: Custom class... WHAT? on: March 14, 2014, 10:05:50 am
Not like that, that's for sure!

Here is one option:
Code:
const int distanceInitialiser[10] = {10, 10, 5, 5, 5, 5, 5, 10, 5, 0};
const int rotationInitialiser[10] = {0, 90, 90, 90, 180, 90, 0, -90, -90, 0};

void setup() {
    memcpy(sequence[0].distance[10],distanceInitialiser,sizeof(distanceInitialiser));
    memcpy(sequence[0].rotation[10],rotationInitialiser,sizeof(rotationInitialiser));
}
41  Using Arduino / General Electronics / Re: Does size matters? :$ on: March 12, 2014, 05:21:18 pm
The resistors I have been using for many things tend to have voltage ratings of 50v or even sometimes as low as 25V, e.g:
http://uk.farnell.com/1863394
42  Using Arduino / Programming Questions / Re: Custom class... WHAT? on: March 12, 2014, 03:22:16 pm
You need a semicolon at the end of your class - I've had that headache before:
Code:
class ... {

};
43  Using Arduino / Microcontrollers / Re: Attiny 861 timer problem on: March 12, 2014, 06:00:10 am
Timer0 only has one register - TCNT0 - its an 8bit timer.

Essentially the timer isn't used to store millis(), a separate unsigned long variable is. The timer is set in a freerunning mode whereby after each 4 times it overflows (0.25 milliseconds each) it increments the variable that millis() returns.

If the internal oscillator is wrong, the millis() function will also be wrong by the same amount. It should never, even with a crystal, be used for time critical events or long term timekeeping (RTC should be used for the latter).
44  Using Arduino / Microcontrollers / Re: I2C communication with a device with a fix adress on: March 11, 2014, 07:24:49 pm
The address is fixed, so you can't change it.

You can use two different I2C buses, yes.

To that end, you could use something like this chip:
http://www.nxp.com/products/interface_and_connectivity/i2c/i2c_multiplexers_switches/series/PCA9547.html
There may be a breakout board for this or some other chip with similar functionality.
45  Using Arduino / Microcontrollers / Re: Attiny 861 timer problem on: March 11, 2014, 07:14:57 pm
OCR1C will be 255 after startup. This is because there is an init() function which is called before setup() which initialises all the timers in an 8bit PWM mode (hence the 255) - this is so that analogWrite() works as expected. If you don't need the PWM pins, then there is no problems with changing the timers.

_BV(n) is the same as (1<<n). It simply creates a bit mask. e.g.:
Code:
_BV(0) == 0b00000001
_BV(1) == 0b00000010
_BV(2) == 0b00000100
etc.

The "|=" bit does the bitwise or of what is in the register already with the mask you have created and saves it back to the register. If you just use an "=" operator it simply assigns the bitmask to the register which means that the bit you want is a 1, but all others in the register are written to 0. This clears the timer 0 interrupt enable bit amongst others.

Regarding the frequency, it will have half of what you think it is because the timer counts from 0 to 243, then toggles the pin, then counts from 0 to 243, then toggles the pin. This means that for a pin to go high to low to high again takes twice as long as you think. It is like doing this:
Code:
delay(500);
digitalWrite(pin,HIGH);
delay(500);
digitalWrite(pin,LOW);
and expecting to get a 2Hz signal - it will actually be 1Hz.

You also have to remember that to get the time in seconds you multiply by (OCR1C+1), not OCR1C. So if you want a value of 244, then you need to set OCR1C = 243.

To get 2Hz, you should use OCR1C=121 as:
OCR1C = (( 0.25 [seconds] * 8000000 [clocks per second]) / 16384 [clocks per period])-1 = 121
Pages: 1 2 [3] 4 5 ... 110