Recent Posts

Pages: [1] 2 3 ... 10
1
Deutsch / Re: UTFT SPI mit ILI9486 Displ...
Last post by themanfrommoon - Today at 10:42 am
Die Arduinos kenn ich leider gar nicht. Ich mach fast alles mit ESP8266
2
Programming Questions / Re: too few arguments to funct...
Last post by AWOL - Today at 10:41 am
Code: [Select]
void changePassword(KeypadEvent neKey)
Code: [Select]
case '0': changePassword();
You promised you'd pass changePassword a single argument, but you didn't.
3
Sensors / Wrong Remote Control Decodific...
Last post by GiovanniBernal - Today at 10:41 am
I wrote a program which would put on or off my room lights and fan, but when I try it, sometimes my Arduino detects different codes from the same control button, I do not Know whats going on or why, could someone help me?

 Here I add a part of the code because it is so long
Please, help me, Thank you :(

Code: [Select]
#include <IRremote.h>
#include <SoftwareSerial.h>

SoftwareSerial Bluetooth (11, 10); //Tx & Rx

const int infra = 3;
const int light = 4;
const int desktop = 5;
const int fan = 6;
//bool state = false;
bool li = false;
bool des = false;
bool fa = false;
int timer = 0;
String words;
char text[25];
int n = 0;
int modes = 1;
const int photo = 9;
const int sound = 8;
const int BT = 7;


IRrecv irrecv(infra);
decode_results code;


void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn();
  Bluetooth.flush();
  delay(500);
  Bluetooth.begin(9600);
  pinMode (13, OUTPUT);
  pinMode (light, OUTPUT);
  pinMode (desktop, OUTPUT);
  pinMode (fan, OUTPUT);
  pinMode (BT, OUTPUT);
  pinMode (12, INPUT);

}

void loop() {

 digitalWrite(BT, HIGH);
  while (modes == 1){
  if (irrecv.decode(&code) || (Bluetooth.available() > 0)){
    Serial.println(code.value, HEX);
     while (Bluetooth.available() > 0){
      text[n] = char(Bluetooth.read());
      Serial.println (text);
      n++;
  }
    words = text;
    Serial.print(words);
  //Serial.println(code.value, HEX);
    if (code.value == 0xFF30CF || words == "li")
      li = !li;

    if (code.value == 0xFF18E7 || words == "des")
      des = !des;

    if (code.value == 0xFF7A85 || words == "fa")
      fa = !fa;

    if (code.value == 0xFFE21D || words == "all"){
     li = false;
     des = false;
     fa = false;
    }
 
    if (code.value == 0xFFA25D || words == "none"){
      li = true;
      des = true;
      fa = true;
    }
    if (code.value == 0xFF9867)
      modes = 2;

    if (code.value == 0xFFB04F)
      modes = 3;
 
  //timer = 1;
  irrecv.resume();
  delay(500);
  }

 if (li == false){
  digitalWrite (light, LOW);
 }else
  digitalWrite (light, HIGH);

 if (des == false){
  digitalWrite (desktop, LOW);
 }else
  digitalWrite (desktop, HIGH);

 if (fa == false){
  digitalWrite (fan, LOW);
 }else
  digitalWrite (fan, HIGH);

  words = "xyz";
    while (n >= 0){
      text[n] = '\0';
      if (n == 0)
      break;                           
     
      n--;
    }
  }
4
Software / Re: WHILE
Last post by SukkoPera - Today at 10:40 am
Forse non ci stiamo capendo. I costrutti, come da manuale sono:

Code: [Select]
while (condizione) {
  // ...
}



Code: [Select]
do {
  // ...
} while (condizione);


Qualunque altra forma non è canonica e probabilmente funziona solo "per caso"!
5
Project Guidance / Re: how to run two or more ste...
Last post by Robin2 - Today at 10:39 am
You have not posted the code you have been trying so I don't know what problem you have had.

If you want to move several steppers at the same time at different speeds but WITHOUT the requirement that they all stop at the same time then the process is very straightforward. The simplest thing is probably to use the AccelStepper library which has the non-blocking run() command.

Alternatively write your own code to cause each step to happen after an appropriate amount of time using millis() or micros() to achieve non-blocking timing. See the second example in this Simple Stepper Code


If you want all of the motors to move through different distances in the same time then things are a little more complex. You need to work out the time for the longest move and then allocate step-intervals for all the other motors so that, for example, one motor makes 237 steps in the same time that another makes 1073 steps. The MultiStepper version of AccelStepper can do that for you - but it does not use acceleration.

...R
Stepper Motor Basics
6
Storage / store the values and the strin...
Last post by abdoboug - Today at 10:38 am
Hello,

I use Arduino Mega, and I want to store the values and the string to the sd card.

Plz, help me to do this!
7
Hi, I am trying to change the password that allows the servo motor to rotate, but i'm getting an error message.I really need your help, because i have tried all that i could but havn't got a solution.

Here is my code
Code: [Select]

#include <Keypad.h>
#include <Servo.h>
#include <Password.h>
#include <EEPROM.h>

int addr  =0;   //the current address in the EEPROM
// Set up keypad variables:
Password password =Password("756");
const byte ROWS = 4;              //four rows
const byte COLS = 3;              //three columns

// Set up servo variables:
int angle = 0;                    // Angle in degrees to position servo [0-180]
Servo servo;                      // Create the servo object

char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};


// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = {3, 8, 7, 5};

// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = {4, 2, 6 };

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
 Serial.begin(9600);           // Start up serial comms
  servo.attach(11);     // Attaches the servo pin 11
  keypad.addEventListener(keypadEvent);     //add an event listener
}

void loop() {
 keypad.getKey();
 servo.write(0);
}

//take care of some special events
void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
    case PRESSED:
  Serial.print(eKey);
  switch (eKey){
    case '*': checkPassword(); break;
    case '#': password.reset();
    Serial.println("PLEASE ENTER PASSWORD");  break;
   case '0': changePassword();
    Serial.println("ENTER NEW PASSWORD");
    password.set(neKey));       break;
    default: password.append(eKey);
     }
  }
}

void checkPassword(){
  if (password.evaluate()){
    Serial.println("PASS CODE SUCCESSFUL");
    for(angle=0; angle<180; angle+=1){
    servo.write(angle);
    delay(15);
  }
    delay(5000);
    for(angle = 180; angle>=1; angle-=1){
    servo.write(angle);
    delay(15);
 
  }
    //Add code to run if it works
  }else{
    Serial.println("ACCESS DENIED! ,PRESS # TO RETRY ");
    //add code to run if it did not work
  }
}

void changePassword(KeypadEvent neKey){
  if(password.evaluate(){)
  switch (keypad.getState()){
  case PRESSED:
  Serial.print(neKey);
  switch (neKey){
    case '*': checkPassword(); break;
    case '#': password.reset();
    Serial.println("PLEASE ENTER PASSWORD");  break;
    default: password.append(neKey);
    }
    }
  }
  }




8
Software / Re: WHILE
Last post by miky_police - Today at 10:37 am
La cosa più bella è che ho usato spessissimo il while omettendo successivamente il do, ed ha sempre funzionato come mi aspettavo. ma non ricordo dove ho letto un codice con while e subito dopo do... forse alla fine di quel do c'era un'altra while :D che ho fatto a meno di leggere...
9
Français / Re: Mise à jour OTA sur une ad...
Last post by Leptro - Today at 10:36 am
Bonjour,

ça ne réponds pas directement à ta question mais j'utilise une répéteur wifi commercial  (19€) , et mes esp sont vus sur le même plage d'adresse que mes autres appareils.


Voir de ce coté peut être?

10
General Electronics / Re: 3.7v li-ion battery
Last post by aradarbel10 - Today at 10:36 am
No it doesn't. Here is the datasheet. The circuit of your board is shown on page 3.
I don't know about your country. There are shipping limitations on lithium batteries in the US, because there have been spontaneous ignitions in depressurized cargo holds on airplanes. They are pretty ubiquitous though. If you use this charger, you should get a larger battery though. Or replace the 'RPROG2' resistor as shown, to accommodate your battery's best charge rate.

And yeah, use a lower voltage circuit if you want to use this battery.
ok, maybe I will replace the resistor in the circuit. but it looks like I will just have to find a different charging circuit for these batteries... and about the microcontroller, I really want to use the ATmega328, so I will boost up the voltage.
Pages: [1] 2 3 ... 10