Page 3 of 3

Re: NXT reading speed

Posted: 10 Oct 2012, 18:39
by floppi
mattallen37 wrote:You mean 10 bit? A 10 bit number is a number between 0 and 1023. The NXT and Arduino both have 10 bit ADCs (although the analog inputs on the NXT have permanent 10k pullup resistors).

How are you controlling the IR LED? I wrote an Arduino library for that as well, in case you're interested.
yes i ment 10bit, i thought nxt was reading a value between 0 and 255 ( 8bit ) and arduino 10 bit ( value between 0 to 1024 ) ?
As i write i found my error : I want to use only 1 sensor port of the nxt, so use pcf8594 which is 8bits, nxt have 10bits adc with sensor port configured for this directly ?

concerning the ir Led I found a ready to use example : i call a function like this : ComboMode(BLUE, RED, CH1);

the function used a digital output with delaymicrosecond to drive the ir led.

Re: NXT reading speed

Posted: 10 Oct 2012, 19:04
by mattallen37
The NXT's analog input pins are connected to the 10-bit ADCs of the AtMega48 co-processor. NXC (and I assume all other programming languages) give the user access to the truly raw values. The analog inputs are also pulled up to sensor supply, through a 10k resistor.

The Arduino analog inputs are connected to the 10-bit ADCs of the (in the case of the Uno) AtMega328.

I'm fairly sure that the PCF8591's ADCs are 8-bit, but I've never personally used that IC.

While that approach should work to control an IR LED, it requires 100% of the processor power available to the user (it can't run in the background). My PFIR library is timer interrupt based, so you use a couple commands to set it up, and then it runs totally in the background. The only time you need to call any PFIR functions after setup, is to set new values (i.e. different motor speeds).

Re: NXT reading speed

Posted: 10 Oct 2012, 19:33
by floppi
mattallen37 wrote:The NXT's analog input pins are connected to the 10-bit ADCs of the AtMega48 co-processor. NXC (and I assume all other programming languages) give the user access to the truly raw values. The analog inputs are also pulled up to sensor supply, through a 10k resistor.

The Arduino analog inputs are connected to the 10-bit ADCs of the (in the case of the Uno) AtMega328.

I'm fairly sure that the PCF8591's ADCs are 8-bit, but I've never personally used that IC.

While that approach should work to control an IR LED, it requires 100% of the processor power available to the user (it can't run in the background). My PFIR library is timer interrupt based, so you use a couple commands to set it up, and then it runs totally in the background. The only time you need to call any PFIR functions after setup, is to set new values (i.e. different motor speeds).
I will take a look on your blog !

My project will be a melting pot of your library at the end :lol:

Re: NXT reading speed

Posted: 10 Oct 2012, 20:03
by mattallen37
Second library on this page.

This post is about an Arduino program that combines the NXTI2C library with the PFIR library, so that the NXT can control PF through the Arduino.