Show Posts
Pages: 1 [2] 3 4 ... 8
16  Using Arduino / Programming Questions / Re: On naming variables, functions and constants on: June 07, 2012, 07:09:41 pm
Interesting.
Do you have a naming system as far as variables go? I often find myself struggling to find logical and organised variable names when several functions need values that are similar in purpose but should be kept as separate registers (most notably lastTimeEventOccured or table index counters)
17  Using Arduino / Programming Questions / On naming variables, functions and constants on: June 07, 2012, 06:50:47 pm
Hi all,

I find myself struggling naming variables, constants and functions I use.
It seems there is something like there is something going on with case depending on the type of object (variable, constant or function) but I can't quite figure it out...

I'm trying to write more readable and understandable code. Any advice?

Thanks,
18  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 07, 2012, 12:43:03 pm
Thanks, this method worked. I initially created the directory in my user folder not on the Macintosh HD
19  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 07, 2012, 12:36:28 pm
Latest developments: I replaced the CTPN2222 transistor with a pin for pin dropin BC547.
And to my surprise, the logic is no longer inversed.
I am glad but I still don't understand what is the difference between these two transistors that would make the logic inverted in the PN2222 and not in the BC547?
20  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 05, 2012, 11:36:51 am
Copying the .plist files to the directory mentioned in the doc doesn't cut it smiley-sad
21  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 04, 2012, 12:22:22 pm

Yes I saw this before but there is no explanation whatsoever regarding how to install it?
22  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 04, 2012, 09:53:50 am
Quote
Processing is the language Arduino is using, is it not?

No. The Arduino IDE is based on the Processing IDE. Processing (the language) is Java, the Arduino language is C/C++.

My bad. So how to have BBEdit display Arduino's language like in the IDE where functions and libraries are highlighted?
23  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 04, 2012, 06:28:24 am
Depending upon your version of BBEdit the following should be used as a rough guide.

BBEdit->Preferences

Select "Languages" from the list on the left.

Click the '+' under the "Custom Extension Mappings" pane.

Select the "Suffix" side of the new entry and enter extension used by your version the Arduino IDE.

Click on the "Languages" side and select "C++" form the pop-up menu.

You should be good to go!

Thanks but when doing this, instructions like pinMode, Serial.begin etc are not recognised and highlighted. This is very useful to read the code and this is what I am trying to accomplish in BBEdit.
24  Using Arduino / Programming Questions / Re: BBEdit v10 and syntax highlighting on: June 04, 2012, 06:27:03 am
Quote
However, I cannot find how to add Processing syntax highlighting and completion
Are you in the habit of asking Arduino questions on the Processing forum, too? What exactly is your Arduino issue?

Processing is the language Arduino is using, is it not?
25  Using Arduino / Programming Questions / BBEdit v10 and syntax highlighting on: June 03, 2012, 05:27:17 pm
Hi all,

I would like to use BBEdit as a code editor.
However, I cannot find how to add Arduino syntax highlighting and completion (the reason why I wanted to use BBEdit in the first place...)

Has anyone ever pulled that off?

--edit: rephrase
26  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 03, 2012, 04:56:37 pm
I cannot fathom what is going on.

This is what I have now for the transistor


And for the photocell


And the code
Code:
const int ledPin = 6;
const int lightPin  = 0;
int   luminosite;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  luminosite = map(analogRead(lightPin), 0, 1023, 255, 0);
// this is inversed because I want the LEDs to become brighter as light increases
  analogWrite(ledPin, luminosite);
  Serial.println(analogRead(lightPin));
  Serial.println(luminosite);
  Serial.println();
  delay(200);
}

The lower the light, the lower the analog value on the photocell. And the higher the value mapped to luminosite.
So, when there is a lot of light, the luminosite should be closer to 255 and the LEDs be very bright.
When there is low light, the luminosite should be closer to 0 and the LEDs be less bright.
This is working as the values output on the serial monitor concur.

What blows my mind is that the LEDs work in reverse logic!!! If I hook one up directly to the Arduino pin, it is fine; 0 = off, 255 = full on.
But when I hook up the transistor, with the exact same code, the opposite happens!! The lower the 0-255 luminosite value, the brighter the LED!
Can anyone figure this out??
27  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 03, 2012, 05:57:05 am
One thought about 10 - 20 mA base current is that you can use a transistor with any Beta value whatever and Know it Will Work, Waste of power, Yes certainly but harmful no I have never found except in cases where the base current exceeded the device specifications that there was any great wrong done, obvious reasons excepted. Sometimes we forget that we were ALL new at something, sometime and advice of that nature about base current can be more defeating than a real lesson should be.
I Know How to do it right... Electronically about 98% of the time, after all occasionally, There is something New... I DO NOT always know how to tell someone else to do it right unless I am Very careful Because Every situation is Different...   IMO

Doc

Thanks, it's much clearer.
However, I don't understand how to “send” only 5mA base current when I have no control over the intensity of the current sent out by the atmega chip. Should I use a resistor? But then it would be a waste of power too, right?
28  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 03, 2012, 05:55:38 am
Yes I put them in series first but I couldn't get any of them lit. I have 10 of them and the current drop was too much for any to light. My schematics has three because I wanted to simplify  the wiring while getting it to work but ultimately I will wire up all 10.
29  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 02, 2012, 08:03:33 pm
Please tell me the you are using at least a 1k resistor on the base... arduino pin.  Secondly, yes, an npn will invert logic but you can work with that if wired right.   When the pin goes highfrom arduino it will turn on and supply gnd path to the leds.   Also, each led should have it's own current limit resistor.


To me, your results sound like a wiring issue.

I have a 220Ω resistor on the base. I'll add 2 other 220Ω for the two LEDs, thanks for the tip
30  Using Arduino / General Electronics / Re: Transistor, PWM and LEDs on: June 02, 2012, 07:27:16 pm
I'm using a PN2222 transistor
Pages: 1 [2] 3 4 ... 8