Recent Posts

Pages: [1] 2 3 ... 10
1
Link to your shield
Explain how you wired and powered everything
Explain how your network works

 Too many things to guess before we can try to offer help
2
India / Need help with logic
Last post by sainikshipth - Today at 08:35 am
Hey, I am working a water sensor, but I cant seem to make it stop after one loop no matter what i do.
here is the code


#include <SPI.h>
#include <Servo.h>

Servo ser;
void setup() {
  // put your setup code here, to run once:
  pinMode(A0, INPUT);
  pinMode(6, OUTPUT);
  ser.attach(A4);
  Serial.begin(9600);
}
void ser1(int, int);
void serp(int);
void serm(int);
int pos = 0;
int strt = 0;
void loop() {
  int count = 0;
  // put your main code here, to run repeatedly:
  int a = analogRead(A0);
  // print out the value you read:
  Serial.println(a);
  if (a != 0)
  {
    count = 1;
    Serial.println("serp");
    serp(count);
   
  }
  else if (a == 0)
  {
    count = 1;
    Serial.println("serm");
    serm(count);
  }

  delay(300000);


}


void ser1(int pos, int count)
{
  Serial.println("ser1");
  if (pos == 1)
  {
    Serial.println("servo++");
    do
    {
      ser.write(pos);
      delay(50);
      pos++;
    } while (pos <= 45);
    count = 0;
  }
  else
  {
    Serial.println("servo--");
    do
    {
      ser.write(pos);
      delay(50);
      pos--;
    } while (pos <= 45);
    count = 0;
  }
 return;
}

void serp(int count)
{
  if (count != 0)
  {
    int pos = 0;
    digitalWrite(9, HIGH);
    ser1(pos, count);
    delay(500);
  }
  else
  {
    delay(1000);
  }
   return;
}

void serm(int count)
{

  if (count != 0)
  {
    int pos = 45;
    digitalWrite(9, LOW);
    ser1(pos, count);
    delay(500);
  }
  else
  {
    delay(1000);
  }
  return;
}





The motor stats off just fine and keeps rotating in that direction. I've tried everything( from my knowledge)

I've also tried including serial.print(); its always struck at "servo--", and won't budge.

I want the arduino to check for the sensor inputs every 5 minutes and iterate only once .
and repeat the same.



How do I do that? and it'd be great if someone could correct my logic/code.

P.S- I've never tried anything like this and I'm out of ideas
3
Sensors / Re: Which means " burn-it" th...
Last post by riemannn - Today at 08:33 am
Hi Alex, thank you for your detailed response. I've got a couple of noob questions, if you have time. I was wondering, what exactly is Rzero? Specifically, why can't we (instead of defining it as a fixed value) continuously retrieve the value of getRZero() or getCorrectedRZero() in real time, and use that retrieved value in the PPM calculations. Or if the Rzero is not constant over time, is that indicative of a problem in the hardware/calibration? If, after calibration, I get a constant Rzero in my living room, do I need to recalibrate it by editing the Rzero value when I move the sensor to my bedroom? Or am I misunderstanding the issue completely? I currently have 2 sensors side by side on the same breadboard, powered separately, measuring within 10 ppm of each other, is that acceptable? (These are averaged values over 30 seconds, 2 measurements per second. Are these numbers OK?) Thanks in advance for any clarification.
4
Project Guidance / Re: 3 interrupts on Uno
Last post by asuryan - Today at 08:27 am
Thanks for your reply!

I didnt know that!

So I can just use attachInterupt with "CHANGE" to any digital pin of the UNO?

I think the encoder library uses "CHANGE" but for the RPM I would need "RISING" or "FALLING" so these have to be on digital pin 2 or 3 right?
5
I think maybe what you're looking for is

int B[5]={0,0,0,0,0};
process_array(B);
for(byte j= 0; j < 5; j++) print(B[j]);
...

void process_array(int *local_array_name)
{
    for(byte j = 0; j < 5; j++) (local_array_name[j] = j);
)

Prints 0,1,2,3,4
6
Project Guidance / Re: Conditional statement for ...
Last post by Robin2 - Today at 08:26 am
Hi! Thanks. I could do that, I was wondering if there was a more precise way to do this though? Or if the joysticks could somehow be calibrated or something so that the center is 512?
No. Joysticks are not that precise. You may be able to reduce the deadband to something smaller than what @Grumpy_Mike suggested after you test with your own joysticks.

This short Thread about controlling a joystick may be of interest.

...R
7
Project Guidance / Re: Handling joystick inputs f...
Last post by Robin2 - Today at 08:23 am
You need to post your complete program so we can see how that function is used.

If it is something to do with a joystick I don't think there is any value in using floating point maths which is very slow on an Arduino.

Also this seems to be the same project as your other Thread. It is much easier to help when you ask all the questions about one project in one Thread so all the info is in one place.

You can click Report to Moderator and ask to have them merged.

...R
8
Nederlands / Re: Amplitude en frequentie va...
Last post by Jarnovis - Today at 08:20 am
Aha, bedankt! Zoiets dacht ik al, want wat voor weerstandwaarden ik ook pakte, de maximale spanning bleef ~3.72V

Is het trouwens verstandig om mijn weerstandwaarden lager te kiezen, zodat mijn maximale waarden ook pas bij maximaal volume bereik of is dat niet mogelijk? Heb dit zelf namelijk nog niet getest.
9
Displays / Re: 2" round display
Last post by Wozsher - Today at 08:19 am
Sounds like we are working on similar projects.
I wanted the round look of a conventional guage. I used a conventional 1.8" rectangular tft but mounted behind a round opening.
10
Project Guidance / Re: Arduino, stepper motor, an...
Last post by wvmarle - Today at 08:13 am
While it is "cool" it totally covers up what he is talking about. 
I also had to go back and think about wtf that was about, after all there's nothing wrong with a proper diagram. Just not Fritzing... even the "schematic view" is pretty horrible.
Pages: [1] 2 3 ... 10