Show Posts
Pages: [1] 2 3 ... 922
1  Using Arduino / Programming Questions / Re: How to test if a led is on without looking at it? on: July 27, 2014, 02:29:55 pm
one could check the low level ports .. These hold the state of the output bits....
2  Community / Gigs and Collaborations / Re: Quick $5 for the first working response on: July 27, 2014, 01:55:02 pm
I was looking for the pinMode for that.
Pins are Inputs by default, I know, but since there was a pinMode for button I was caught up looking for one for "pot" (nonesuch).

When are there ever pinMode calls for analog pins?
When you want to use an analogPin as digital output...
3  Using Arduino / Programming Questions / Re: How to test if a led is on without looking at it? on: July 27, 2014, 01:51:50 pm
Code: (demo)
void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(115200);
  Serial.println("Start ");
}

void loop()
{
  digitalWrite(13, random(2)); // 50% chance HIGH/LOW
  
  if (digitalRead(13) == HIGH) Serial.println("ON");
  else Serial.println("OFF");
  delay(1000);
}
4  Using Arduino / Programming Questions / Re: on off swich on: July 27, 2014, 01:44:14 pm
it activates the pull down resistor for an input.
5  Using Arduino / Programming Questions / Re: Need to increase speed with 2 switch sketch. on: July 27, 2014, 01:42:50 pm
you must try not to use delay or delayMicroseconds at all except for the most simple sketches.

Code: (not tested)
const int LED1 = 5;
const int LED2 = 6;
unsigned long oneLed= 0;
unsigned long otherLed = 0;
unsigned long interval = 100000;
unsigned long checkSwitch1 = 0;

void setup()
{
}

void loop()
{
  if (micros()  - oneLed > 100000UL)  // 10 x per second
  {
    digitalWrite(LED1, !digitalRead(LED1)); // toggle the led
    oneLed += 100000UL;
  }
  if (micros()  - otherLed > interval )
  {
    digitalWrite(LED2, !digitalRead(LED2)); // toggle the led
    otherLed += interval ;
  }

  if (millis()  - checkSwitch1 > 250) // test switch 4 times per second
  {
    checkSwitch1 += 250;
    state = digitalRead(switchPin);
  }

  if (state == HIGH)   // change the interval of the LED 2 depending on the state of the switch
  {
      interval = 100000;
  }
  else
  {
    interval = 400000;
  }
}
6  Using Arduino / Interfacing w/ Software on the Computer / Re: Send correct data to SC on: July 27, 2014, 12:30:15 pm

As the Arduino multiplexes the analogReads they affect each other. Could be a cause
One way to handle this is to do multiple reads and throw away the first one.

Code: (compressed a bit)
float get_light_level()
{
  analogRead(REFERENCE_3V3);  // dummy read
  float operatingVoltage = analogRead(REFERENCE_3V3);

  analogRead(LIGHT); // dummy read
  return analogRead(LIGHT) * 3.3 / operatingVoltage;
}

632  / 3.3  *  5.0 = 957 ( comes close to 1023)  could that be a cause?

632 just being the max value for 3.3 volt
7  Using Arduino / Project Guidance / Re: RTC on: July 27, 2014, 11:16:45 am
depends on the number of interrupts on your system as these affect local time keeping.
Furthermore depending on the accuracy you need, you can read the RTC once per hour or per day.

Note that the accuracy of RTC's is also limited, some drift more than others.
8  Using Arduino / Project Guidance / Re: Using Large Text on: July 27, 2014, 11:13:36 am
Indeed my code above does not work, however it puts the large text in FLASH as shown by the compilation output.
thanks for pointing out

update
this version works
Code:

#include <avr/pgmspace.h>

char PROGMEM largeText[] = "\n\
Hello,\n\
\n\
I would like to process a text, that is too long to be saved in a char array. \n\
Is there a possibility to load the text file to the arduino flash memory and read from the text file?\n\
\n\
Or what would be the best way to use larger texts in arduino programms (if possible\n\
only with the Arduino UNO- without  additional SD Card or connenction to a PC- these solution I found)\n\
\n\
Thanks and regard\n\
\n\
Adriana\n\
Hello,\n\
\n\
I would like to process a text, that is too long to be saved in a char array. \n\
Is there a possibility to load the text file to the arduino flash memory and read from the text file?\n\
\n\
Or what would be the best way to use larger texts in arduino programms (if possible\n\
only with the Arduino UNO- without  additional SD Card or connenction to a PC- these solution I found)\n\
\n\
Thanks and regard\n\
\n\
Adriana\n\
Hello,\n\
\n\
I would like to process a text, that is too long to be saved in a char array. \n\
Is there a possibility to load the text file to the arduino flash memory and read from the text file?\n\
\n\
Or what would be the best way to use larger texts in arduino programms (if possible\n\
only with the Arduino UNO- without  additional SD Card or connenction to a PC- these solution I found)\n\
\n\
Thanks and regard\n\
\n\
Adriana\n\
Hello,\n\
\n\
I would like to process a text, that is too long to be saved in a char array. \n\
Is there a possibility to load the text file to the arduino flash memory and read from the text file?\n\
\n\
Or what would be the best way to use larger texts in arduino programms (if possible\n\
only with the Arduino UNO- without  additional SD Card or connenction to a PC- these solution I found)\n\
\n\
Thanks and regard\n\
\n\
Adriana\n\
Hello,\n\
\n\
I would like to process a text, that is too long to be saved in a char array. \n\
Is there a possibility to load the text file to the arduino flash memory and read from the text file?\n\
\n\
Or what would be the best way to use larger texts in arduino programms (if possible\n\
only with the Arduino UNO- without  additional SD Card or connenction to a PC- these solution I found)\n\
\n\
Thanks and regard\n\
\n\
Adriana\n\
";

void setup()
{
  Serial.begin(115200);
  Serial.println("Start...");

  int idx = 0;
  while((char)pgm_read_byte_near(&largeText[idx]) != '\0')
  {
    Serial.print((char)pgm_read_byte_near(&largeText[idx]));
    idx++;
  }
}

void loop()
{
}

note it prints one char at the time
9  Using Arduino / Project Guidance / Re: Quadcopter Follow me on: July 27, 2014, 11:12:29 am
if the person transmits (ultrasonic) beeps - 1 rotating /sweeping micro can be used to determine direction of the strongest signal


or use 2 micros (A&B)  and do triangle-math
Speed of sound is "slow",  10 cm difference would result in 1/3400 sec time diff  = 300usec 
If the distance between A & B  is e.g 20 cm one can do the math to determine direction
if both A & B receive the time at the same moment the person is in the direction perpendicular to the line AB


10  Using Arduino / Project Guidance / Re: Projector hardware? on: July 27, 2014, 10:43:27 am
think they use mems mirrors (IC with mirros) that can be switched very fast..
11  Using Arduino / Project Guidance / Re: WEARABLE HEART ATTACK DETECTOR on: July 27, 2014, 10:41:35 am
think Android with GPS, google Maps and hospital geo-search, etc
Not an Arduino...
12  Using Arduino / Sensors / Re: Adafruit library and test sketch for BMP085 on: July 27, 2014, 10:35:20 am
Note: The screenshot is rotated/

It seems that the library is not in the right place.
I do not know the tool you use, but the Arduino IDE needs to be reloaded to see new libraries.
Did you try that?
13  Using Arduino / Project Guidance / Re: check pump control on: July 27, 2014, 07:49:30 am
CTRL-T does only work on windows, don't know for Mac/linux

Menu -> Tools -> Autoformat  does the trick
14  Using Arduino / Project Guidance / Re: Where do I start with automated watering system for 9 plants? on: July 27, 2014, 07:48:29 am
not to hijack the thread....  anyone know of a simple rain sensor ?
used aluminium foil strips (on a ramp) to detect it was raining. The drops rolled of the ramp but gave measurable pulses.

or do you want to measure how much it rained?
- reservoir with a height sensor
15  Using Arduino / Project Guidance / Re: Using Large Text on: July 27, 2014, 07:45:37 am
FLASH is 32 KB so it can easily hold a 5KB text string. ... just tried 9KB .... when using PROGMEM,
Pages: [1] 2 3 ... 922