Pages: [1] 2 3 ... 10
 1 
 on: Today at 12:39:39 am 
Started by caiopro - Last post by bubulindo
De onde fizeste download da biblioteca?

Que placa seleccionaste na IDE?

 2 
 on: Today at 12:37:30 am 
Started by florios - Last post by waski
In void setup() put :

Code:
digitalWrite(motor1, LOW);
digitalWrite(motor2, LOW);
....
etc

To make shure that when arduino resets, your pumps don't start accidentally.
Then, look at " Blink without delay" example from Arduino IDE - using delay() here is ok but when you decide to add more things to your code , dalays will give you trouble.

And just a cosmtetics :

Change

Code:
int const motor1 = 9;
int const motor2 = 11;
int const motor3 = 12;
int const motor4 = 13;

to
Code:
byte const motor1 = 9;
byte const motor2 = 11;
byte const motor3 = 12;
byte const motor4 = 13;

Just to save a little bit of RAM smiley

 3 
 on: Today at 12:34:10 am 
Started by Dvir812 - Last post by Dvir812
Hi
I did some test with the code you gave me ( with some minor lcd pins change )
The LCD display 165/165/165
                                 45:165:165

What does it mean ?


 4 
 on: Today at 12:31:07 am 
Started by majika - Last post by astrobeed
Sei anche tu un colosso dei semiconduttori in perdita?  smiley-roll  smiley-lol

Piccola premessa, io non sono ACME Systems, sono amici e ci si vede ogni tanto, riescono a contenere i costi perché producono loro in sede, si tratta di vero made in Italy, e perché vendono molti pezzi dei loro prodotti, ovvero quando acquistano non prendono 20-30 pezzi, ne prendono migliaia il che permette di abbattere notevolmente il costo.
Se sei curioso qui puoi vedere una serie di foto fatte in Acme, inclusa la linea di produzione, l'estate scorsa dal mio amico Guido, era una presentazione di Aria G25 dedicata agli amici, come puoi vedere il tutto era molto informale smiley

 5 
 on: Today at 12:29:40 am 
Started by yosualie8 - Last post by waski
This picture isn't really helpfull. We need to see which pins are used. I'm only guessing than buttons are connected to pins 2 - 13 and 22 - 53 . Rest of them are not used.  Post any drawing or tell us to which pins you connect buttons .

 6 
 on: Today at 12:29:37 am 
Started by florios - Last post by florios
hey guys i have some code i want checked so i dont kill all my fish.

I just made this quick so tell me if theres something i should be worried about.

explanation:

so i have 4 dosing pumps the 4th one not being used, but i have it defined in the code.

i am using a RTC to keep time, at 8 30 i have pump one turn on delay 5 seconds, turn off, then 2 second pause, repeat for pump 2 and 3. then a 60 second pause to wait for the minute to change so it does not repeat.

please let me know if any changes should be made, if any of these over dose it could be fatal for my fish.

Code:
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 rtc;

int const motor1 = 9;
int const motor2 = 11;
int const motor3 = 12;
int const motor4 = 13;



void setup () {
 
   pinMode(motor1, OUTPUT);
 pinMode(motor2, OUTPUT);
 pinMode(motor3, OUTPUT);
 pinMode(motor4, OUTPUT);
 
  Serial.begin(57600);
#ifdef AVR
  Wire.begin();
#else
  Wire1.begin(); // Shield I2C pins connect to alt I2C bus on Arduino Due
#endif
  rtc.begin();

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    //rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop () {
    DateTime now = rtc.now();
   
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
   
    if( (now.hour() == 8 ) && (now.minute() == 10))
      {digitalWrite(motor1, HIGH);
       delay(5000);
       digitalWrite(motor1, LOW);
       
       delay(2000);
       
       digitalWrite(motor2, HIGH);
       delay(5500);
       digitalWrite(motor2, LOW);
       
       delay(2000);
       
       digitalWrite(motor3, HIGH);
       delay(5000);
       digitalWrite(motor3, LOW);
       
       delay(60000);
      }   
     
     
   
   
    delay(1000);
}

 7 
 on: Today at 12:27:16 am 
Started by sonnystikz - Last post by PaulRB
i hooked up 1 pot to an analog in on my Mega 2560 and used a basic midi CC code- my software read  the pot well- but sometimes it appeared to send signals while i wasnt touching it- - the software midi Input light came on and the attached midi CC knob seemed to shake by a % or 2- figured i may need a cap on the 5v pot pin- - tho it's off topic i searched and havent found a clear answer yet

Noise. You are dealing with analog signals so it is inevitable. However, with care it can be reduced down to an acceptable level. You could try a 0.1uF cap between the analog pin and ground. Also you can change your sketch to take the average over many readings.

Paul

 8 
 on: Today at 12:25:08 am 
Started by alex_lev - Last post by alex_lev
Hi,

I just got the starter kit and am going through get to know your tools example. It says that I need to connect the cathode to the ground using a wire. The pictures implies there is a wire with a red block on it. Same goes for the anode. However I cant find these wires at all. Is this supposed to be included or do I provide it myself? If included, where did you find it (which box) and what did it look like?

Thanks!

 9 
 on: Today at 12:21:53 am 
Started by Piethon - Last post by Piethon
Hooray! Thank you everyone for your replies, it helped a lot - special thanks to Robin2, I used your sketch and now have my servo sweeping back and forth.  I can turn the servo on, by pressing 4, and then turn on a laser (or have it blink)!  smiley-mr-green

I only have to more questions:
1) Is this the most efficient way to set up the sketch? It seems to me to be a little verbose (although admittedly, I think I have a few extra variables I don't need). 

2) The Servo will sweep and I can then turn on a laser.  However, when I press '5' to turn it off, my lasers stop as well.  I assume this is because I'm using case to determine which button I pressed, and in doing so, I 'negate' having turned the laser on with another button.  Is there a way to fix this, so I can independently turn the servo on and off without affecting the laser? Would I need to combine a switch, or create a new function with switch to look at 4 and 5 separately? I am having trouble visualizing how I'd do that, so thank you for any help!

Here's my current code:

Code:
#include <IRremote.h>
#include <Servo.h>


const int LEDpin = 4; // set up LED Pin [not used below, was earlier to confirm upload was working]
const int laserPin = 12;

// IR SENSOR SETUP ------------
int IRpin = 5;
IRrecv irrecv(IRpin); // create instance of 'irrecv'
decode_results results; //create instance of 'decode_results'
int remoteBtn = 0; // set variable to determine which button on remote was pressed
// -------------------------

// SERVO SETUP -------
Servo myservo; // create servo object to control a servo
int pos = 0;   // variable to store the servo position
int servoSweepvar = 0;  // variable to determine if the servo should be sweeping or not.
const int servoMinDegrees = 10;
const int servoMaxDegrees = 170;
int servoPosition = 90; // starting position of Servo
int servoSlowInterval = 80;
int servoFastInterval = 10;
int servoInterval = servoSlowInterval;
int servoDegrees = 1; // how many degrees to increment the Servo


int laserDelay; // set a delay variable for the laser blink
const int remoteDelay = 500;
const int servoDelay = 15;
// -------------------------

byte laserState = LOW;
byte laserSlowState = LOW;
byte laserSlowerState = LOW;


unsigned long currentMillis = 0;
unsigned long previousSlowLaserMillis = 0;
unsigned long previousSlowerLaserMillis = 0;
unsigned long previousRemoteMillis = 0;
unsigned long previousServoMillis = 0;

void setup() {
  Serial.begin(9600);
  myservo.attach(9);    //attached the servo on pin 9 to the servo object
  pinMode(LEDpin, OUTPUT);
  pinMode(laserPin, OUTPUT);
  // pinMode(PIRpin, INPUT); //I removed the PIR pin
  irrecv.enableIRIn();  // start the receiver
}

void loop() {
  currentMillis = millis();
 
  if (irrecv.decode(&results)) {    // have we rec'd an IR signal?
  // Serial.println(results.value, HEX);     // this will show the RAW value of remote press
  translateIR();
  irrecv.resume();
  }
  remoteEvents();
}

// ----- FUNCTIONS BELOW

void translateIR(){
  if (currentMillis - previousRemoteMillis > remoteDelay){  // do not get immediate repeat remote reading
    previousRemoteMillis = currentMillis;
  switch(results.value) {
    case 0xFF6897: Serial.println(" 1"); remoteBtn = 1; break;
    case 0xFF9867: Serial.println(" 2"); remoteBtn = 2; break;
    case 0xFFB04F: Serial.println(" 3");    remoteBtn = 3;     break;
    case 0xFF30CF: Serial.println(" 4");    remoteBtn = 4; servoSweepvar = 1;    break;
    case 0xFF18E7: Serial.println(" 5");    remoteBtn = 5; servoSweepvar = 0;    break;
    case 0xFF7A85: Serial.println(" 6");    remoteBtn = 6;     break;
    case 0xFF10EF: Serial.println(" 7");    remoteBtn = 7;     break;
    case 0xFF38C7: Serial.println(" 8");    remoteBtn = 8;     break;
    case 0xFF5AA5: Serial.println(" 9");    remoteBtn = 9;     break;
    case 0xFF42BD: Serial.println(" *");    remoteBtn = 10;     break;
    case 0xFF4AB5: Serial.println(" 0");    remoteBtn = 0;     break;
    case 0xFF52AD: Serial.println(" #");    remoteBtn = 11;     break;
    default: Serial.println(" other button     ");
  } // end Case
} //end translateIR
}

void remoteEvents(){      // Start the remote Events for the LASER
  if (servoSweepvar == 1) {
    servoSweep();
  } else { servoSweepStop(); }
  switch (remoteBtn) {
      case 1:
        steadyLaser();
        break;
      case 2:
        laserDelay = 500;
        blinkingLaser();
        break;
      case 3:
        laserDelay = 250;
        blinkingLaser();
        break;
      case 0:
        offLaser();
        break;
      case 4:
        servoSweep();
        break;
      case 5:
        servoSweepStop();
        break;
  }
}

void steadyLaser(){
  if (laserState == LOW){
    laserState = HIGH;
  }
  digitalWrite(laserPin, laserState);
}

void blinkingLaser(){
  if(currentMillis - previousSlowLaserMillis >= laserDelay){
    previousSlowLaserMillis = currentMillis;
 // if the LED is off turn it on and vice-versa:
    if (laserSlowState == LOW) { laserSlowState = HIGH; }
    else { laserSlowState = LOW; }
  digitalWrite(laserPin, laserSlowState);
}
}

void offLaser(){
  digitalWrite(laserPin, LOW);
}

void servoSweep(){
  servoSweepvar = 1;
  if (currentMillis - previousServoMillis >= servoInterval){
    previousServoMillis += servoInterval;
  servoSweepvar = 1;                   // This sets servo sweep to '1' for the looping
  servoPosition = servoPosition + servoDegrees;
  if (servoPosition <= servoMinDegrees) {
    if (servoInterval == servoSlowInterval) {
      servoInterval = servoFastInterval;
    }
    else {
      servoInterval = servoSlowInterval;
    }
  }
 
  if ((servoPosition >= servoMaxDegrees) || (servoPosition <= servoMinDegrees)) {
    servoDegrees = - servoDegrees;
    servoPosition = servoPosition + servoDegrees;
  }
  myservo.write(servoPosition);
 
  }
}

void servoSweepStop(){
  servoSweepvar = 0;
  myservo.write(servoMinDegrees);   // return servo to 5 degrees
}





Thanks for any ideas and again, thanks for all your help, this is a very educational project for me!


 10 
 on: Today at 12:21:08 am 
Started by davidl_i - Last post by lar3ry
Hello, I have a problem with one of my projects. I used the freeRam() function and library to detect how much free RAM there is and it said about 1200KB.

I WANT one of those 1.2 MByte Arduinos!

As waski said, post your code. Assuming you meant 1200 bytes, rather than 1200 KB, your problem is likely in your code. Free RAM is only meaningful in a program that has no bugs, and in which you are not fragmenting the memory with things like String objects.

Pages: [1] 2 3 ... 10