Show Posts
Pages: [1] 2 3 ... 8
1  Using Arduino / Installation & Troubleshooting / Re: Please explain Arduino 1.5 Library folders on: April 27, 2014, 10:37:04 pm
Well I guess I found some information myself. From what i understand is that when you #include a library, the compiler will first look in your sketch/Libraries folder, then will look in the arduino/Libraries folder and failing that will look in the platform/libraries folder.
While I understand this may look neater and be easier for the library writers to write something specific to their product, my experience is that libraries are subtly adapted by even non-pros like myself to fit a particular application. It was easy to keep track of when they were all in one folder. I think this will make it very difficult for the weekend hackers to find and install libraries and makes Arduino not so easy and friendly anymore just to accommodate higher end processors. If Teensy can do use high-end processors and keep it simple then so should Arduino.
2  Using Arduino / Installation & Troubleshooting / Please explain Arduino 1.5 Library folders on: April 27, 2014, 01:46:34 pm
I apologize if this is covered elsewhere but I am seeking a simple explanation of the Arduino 1.5 IDE in regards to the library folders.
In 1.05, there was 1 common library folder which I understood.
In 1.5 it seems there is still a Library folder in \Arduino\Libraries but there is also a Library folder for each variant, example Arduino\Hardware\Arduino\Rfduino etc.

Does this mean that if you have a library like Adafruit_GFX you have to install that for every platform that you intend to use?
I just installed the latest 1.5 Beta and when I try to import Adafruit_GFX, it says the library already exists.
After doing a search I see that this library is included in the folder Arduino\Libraries\Robot_Control\SRC\Utility.
However when I try to compile my sketch which includes  #include <Adafruit_GFX.h>, it says no such file or directory.

This is very confusing as it seems I cannot install a library because it exists "somewhere" but not in a place that the compiler can find.
The only reason I am even bothering with this is that i am trying the RFduino which will only use 1.5.

Any help appreciated.


Thanks
3  Using Arduino / Project Guidance / Lowest power method for 2 digit LCD on: March 26, 2014, 04:49:27 pm
Looking for some direction.
I want to display a sensor value on a 2 digit LCD. I know there are ways to drive these directly from the micro controller or use a driver IC. As pin-count is not an issue, but cost and low power are important which method would be better? I am assuming when you use a driver IC you could put the micro to sleep if say sensor updates are only required every minute or so but could you do that with driving directly?
I have never used these types of LCD before so I am wanting to know feasibility before i start buying.
I would like to run it off 1 or 2 batteries.

Any example projects would be great.
Thanks for your input
4  Using Arduino / Programming Questions / Re: Write button inputs to array - Help needed on: March 21, 2014, 07:54:41 pm
Quote
Ignore the count and IF statements as they are just there for control in this example.
5  Using Arduino / Programming Questions / Re: Write button inputs to array - Help needed on: March 21, 2014, 06:20:01 pm
Quote
Is your code designed so it can read the buttons interspersed with reading the sensors and sending out the results?
Yes, I am using 4D Systems Libraries and event handlers so the code would not be useful as you cant run it unless you have a device, and all it outputs is the buttonInput flag and the keyInput values in amongst all the sensor values. I dont care about the timing because that is handled in the touchscreen.  I just need to capture the buttonInput values to an array.

As an example, see this basic code. It just simulates a loop with 2 keyInput values arriving at different times.
The array starts with values of  2,4. after 10 loops, the key[0] value changes to 8 and after another 10 loops, key[2] changes to 3.
Ignore the count and IF statements as they are just there for control in this example.

I need a better way to recognize that after the buttonInput flag is set, the first keyInput value seen should be written to key[0] and the 2nd one should be written to key[1]
Then how  write those values to variable as 1 number 83.

I have probably been staring at it too long.
Thanks

Code:
int buttonInput = 1;
int key[3] = {2,4};
int keyInput;
int count = 0;

void setup() {
  Serial.begin(115200);     
}

void loop() {
  Serial.println("output");
 
  if (count > 10)
  {
    keyInput = 8;
    key[0] = keyInput;
  }
  if (count > 20)
  {
    keyInput = 3;
    key[1] = keyInput;
  }   
  if (count >25)
  {
    buttonInput = 0;
  }
  Serial.println(key[0]);
  Serial.println(key[1]);
 
  if (buttonInput == 0)
  {
    Serial.println ("send to trigger");
  }
  count = count + 1;
   delay(500);
}
6  Using Arduino / Programming Questions / Write button inputs to array - Help needed on: March 21, 2014, 03:12:36 pm
I have a sketch that outputs different sensor values constantly and this should continue uninterrupted. I have an input from a touchscreen (like a keypad) where the user can set a new trigger value for one of the sensors. So he will choose a sensor which sets a flag (buttonInput =1) and when this button is set, he can set a new 2 digit trigger value (keyInput).
Problem is the keypad sends the values in 1 character at a time and after the first character there may be several sensor outputs written (loops through the code) before the next keyInput arrives.

i understand that i could use a for-next loop to stop the main loop and wait for the 2 inputs sequentially, write them to an array and continue with the main loop, but I dont want to interrupt the main loop as the sensor values go to a plot file.

I need this 2 digit value to be saved as a number meaning -
key[0] = 8
key[1] = 3
keyValue = 83 which will be the new trigger value.

Attached is the serial monitor output which shows various sensor values written and then buttonInput is set to 1. In between some more sensor values are keyInput values which should be written to key[0] and key[1] respectively, or some other way of turning the 2 inputs into an integer value. If required, the key sequence can be ended by * or whatever else is required.

Any help to structure this in the most efficient way is appreciated.

Code:
buttonInput = 0
30.00
29.46
10.05
29.84
28.75
30.00
29.46
10.05
29.84
28.75
buttonInput = 1
30.00
29.43
10.02
29.84
28.75
Key input = 8
31.00
29.38
10.47
29.84
28.75
31.00
29.35
10.44
29.85
28.75
Key input = 3
31.00
29.32
10.42
29.85
28.75
Key input = *
31.00
29.30
10.40
29.84
28.75
buttonInput = 0
31.00
29.31
10.41
29.84
28.75
7  Using Arduino / General Electronics / Re: Pre made keypads or PCBs on: March 21, 2014, 11:47:07 am
I have some tactile membrane keypads with 5 buttons, like in the picture attached.
Let me know if this would work for you.
8  Using Arduino / Programming Questions / Re: Functions returning data vs changing global variable. on: March 03, 2014, 03:04:12 pm
Thank you -
Mostly you guys are talking over this noob's head, but I do understand.
I did just change 1 function to use pointers instead of return, and you are correct, it totally bogged down the speed in my application. I changed all functions to use globals and didnt see a major difference compared to using returns, but I believe there is a little.

Thanks again for the advice.
9  Using Arduino / Programming Questions / Re: Functions returning data vs changing global variable. on: March 03, 2014, 12:58:47 pm
Thank you for excellent answers.
My sketch is basically polling 4 sensors through I2C, Each one has a conversion computation involved so each is in a function. Another 2 functions do some other calculations.
All 6 these values are being sent to a 4D Systems LCD which is where the bottleneck is I guess. Because they dont handle -ve values i am converting each value to Char via dtostrf() and sending that via serial.

I was just wondering if speeding up the functions could help but you have answered my question.

Thank you very much. I learn every day
10  Using Arduino / Programming Questions / Functions returning data vs changing global variable. on: March 03, 2014, 10:31:16 am
I would like some advice whether it is better to have a function return data to the loop or just have the function update a global variable. I know that it is tidier and uses less memory if a global variable is not used, but my question is more related to program speed and also sometimes more than 1 variable needs to be updated from a function.
With a lot of function calls, it seems to be slower with returns vs Global updates but I may be wrong.

Any advice is appreciated.
11  Using Arduino / Programming Questions / Re: How to send a NACK with wire on: March 01, 2014, 06:54:21 pm
Thank you very much.
That solved it. I didnt know the wire library took care of the read address.
Thanks again
12  Using Arduino / Programming Questions / How to send a NACK with wire on: March 01, 2014, 03:13:34 pm
I am trying to get a sensor working with I2C in Arduino. I have already used this sensor successfully with another micro. The I2C sequence is basically the same as most others EXCEPT that the datasheet seems to require a NACK prior to ending the transmission. The 4D IDE has a NACK command, and I confirmed that removing the NACK broke the communications. With the NACK command i get data.

The datasheet for the si7021 is http://www.silabs.com/Support%20Documents/TechnicalDocs/Si7021.pdf
On pg 19 is the sequence with the NACK after receiving 2nd Byte
If I am correct in my assumption, how do I send a NACK from Arduino?

My testing code is below. I never receive any data and also never get the "2nd wire end" reply.

Am I doing something wrong?

Code:
#include <Wire.h>

void setup()
{
  Wire.begin();                // join i2c bus (address optional for master)
  Serial.begin(9600);          // start serial communication at 9600bps
}

int reading = 0;

void loop()
{
  // step 1: instruct sensor to read echoes
  Wire.beginTransmission(0x80); // transmit to device
  Serial.println("wire begin 0x80");                         
  Wire.write(byte(0xE5));      // sets register pointer to the command register (0xE5) 

  if (Wire.endTransmission () == 0)
  { 
    Serial.println("1st wire end");
  }
  // step 2: wait for readings to happen
  delay(70);                   

  // step 3: instruct sensor to return a particular echo reading
  Wire.beginTransmission(0x81); // transmit to device in read mode

  // step 4: request reading from sensor
  Wire.requestFrom(0x81, 2);    // request 2 bytes from slave device

  if(2 <= Wire.available())    // if two bytes were received
  {
    reading = Wire.read();  // receive high byte (overwrites previous reading)
    reading = reading << 8;    // shift high byte to be high 8 bits
    reading |= Wire.read(); // receive low byte as lower 8 bits
    Serial.println(reading);   // print the reading
  }

  if (Wire.endTransmission () == 0){
    Serial.println("2nd wire end");
  }
  delay(250);                  // wait a bit since people have to read the output :)
}
13  Using Arduino / Programming Questions / Re: Running Graph display on TFT LCD on: February 15, 2014, 11:58:37 pm
Thank you Hazardsminds.
Your answer is very useful and ives a good starting point.
Much appreciated.
14  Using Arduino / Programming Questions / Running Graph display on TFT LCD on: February 15, 2014, 07:01:25 pm
I would like to display the value of 2 sensors on a TFT LCD display in running graph format. the 2 graphs will have different colors.
Basically all i need is a live trend rather than exact pixel values but that would be nice too.
Are there any projects out there with some examples to get me started in selecting the right lcd and a start with the code on a Uno?
I have only found some barograph examples on dot matrix lcd's

Any help is appreciated..
15  Using Arduino / General Electronics / Re: Need help reading a power MOSFET datasheet on: November 07, 2013, 02:10:11 am
Sorry mike is correct on VGS, its the threshold.
Pages: [1] 2 3 ... 8