Recent Posts

Pages: [1] 2 3 ... 10
1
But I don't see any function definition in the header file? Or I am missing something?
2
Deutsch / Re: Darf ich um Tipps zur Prog...
Last post by gregorss - Today at 10:29 am
in der Arduino IDE einfach die "STRG + T" drücken, dann wird der Code automatisch formatiert.
Das stimmt zwar und liefert ein gutes Ergebnis, wenn man vollkommen unformatierten Code mit Strg-t behandelt, ich habe aber auch schon erlebt, dass händisch aufgehübschter Code wieder hässlich wurde, weil dort Zeilenumbrüche eingefügt wurden, wo ich sie absichtlich weggelassen hatte.

Kann sein, dass sich die automatische Formatierung diesbezüglich gebessert hat. Aber vorher zu speichern ist nie verkehrt :-)

Gruß

Gregor
3
Project Guidance / Re: Quad copter stabilization
Last post by Panda01 - Today at 10:29 am
I am making a 'x' style quadcopter


Based on how you have applied the PID outputs to the motors I assume you are making a '+' style quadcopter rather than 'x'?
4
Hi guys... I have programmed an Arduino Pro Mini before, but I am having no luck with the one I got recently. The crystal oscillator says 8.0, so it must be the 8mhz version, as I have correctly selected. I am using a serial adaptor with the DTR pin. I have it connected corretly, that is Rx to Tx, etc. The serial adaptor seems ok, gets normally recognized by Windows and works, as I have tested by shorting the Rx and Tx together and echoing some characters.

The Arduino environment sends the following command to AVRDude:

M:\Program Files\Arduno 1.6.11\hardware\tools\avr/bin/avrdude -CM:\Program Files\Arduno 1.6.11\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM14 -b57600 -D -Uflash:w:G:\AppData\Local\Temp\build809ceec5e21ecb4144db9bcd5f564f91.tmp/Blink.ino.hex:i

But the response is:

       Using Port                    : COM14
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xd6
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xd6
avrdude: stk500_recv(): programmer is not responding

(...)

I have actually tried re-burning the bootloader and although I succeeded (so the chip is okay!), it didn't fix my issues...


I have tried reading the fuse settings, but the fuses seem okay!
 
(this is using Arduino as ISP)


avrdude: AVR device initialized and ready to accept instructions

I was like:



C:\Users\thegoodhen>avrdude -P COM3 -b 19200 -c avrisp -p m328p -v

And the other dude Avrdude was like:

Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


Oh wait... is the baud rate correct? I have to check... Well anyway, if you have any idea why its behaving like this, please please do tell.
5
Megatopic / Re: [OT] Stampa 3D per tutti ....
Last post by 5a2v0 - Today at 10:27 am
ciao a tutti.. finalmente ho anch'io una stampante 3d, ma è arrivata con qualche problema..
Intanto la stampante è questa LINK EBAY (mi è stata regalata) e si, so che allo stesso prezzo c'erano altre inserzioni dove davano la prusa con il piatto di dimensioni "normali". Ma a caval donato...
Una volta assemblata ed accesa, sul display si notava la presenza del fw Repetier v 0.91 e riuscivo a collegarmi tranquillamente con il RepetierHost e l'esecuzione di comandi manuali andava a buon fine.
Dopo aver fatto una veloce configurazione sui profili di slicing e stampa, abbiamo provato a stampare un semplice cubetto di prova e sono iniziati i problemi.

Qualunque stampa io lanciavo da pc o da SD, partiva regolarmente ma dopo un tot imprecisato la stampante o si spostava e continuava a stampare in posizioni errate, o si fermava e in tutti i casi il RepetierHost rilevava problemi di comunicazione e si arrestava la connessione.

Dopo svariate letture e ricerche su web ho deciso di intraprendere la strada dell'aggiornamento firmware e passare al Marlin (consigliatomi da un amico) cosa che non sono riuscito a fare in quanto pur provando le versioni dell'IDE 1.0 1.05 1.6 e 1.8 riuscivo a compilare e a caricare usando solo la 1.05 ma il display della stampante non era funzionante. Ho tentato di abilitarlo nel config di Marlin ma ottenevo sempre e solo errori di compilazione o caricamenti che non davano frutti..

Cercando cercando, ho trovato una versione del  Repetier fatta apposta per la mia stampante con display a 5 tasti, la provo (0.92.5) e parte regolarmente. Regolo qualche impostazione e stampo da pc --> stesso problema. Riprovo da SD e stavolta va, senza problemi e ho fatto molto piu di una stampa di prova proprio per testare.

Ho anche provato a far partire la stampa da SD ma mentre era collegata al pc leggere da RepetierHost lo stato della stampa e anche stavolta ha avuto problemi di comunicazione (ma la stampa ha continuato perchè era stata lanciata da sd..)


La scheda di controllo è una Melzi 2.0 v5.
Per poter caricare il firmware ho dovuto scrivere il bootloader usando come board "Melzi 1284p 16mhz".


Il mio dubbio è se il problema potesse essere semplicemente il chp FTDI che magari durante la stampa e l'uso intensivo dello stesso (invio dei vari stati e ricezioni di tutti i comandi) crei errori di comunicazione.
Ho provato ad abbassare tantissimo il baudrate e diminuire la cache size ma non ho mai risolto nulla.
Potrei provare secondo voi a sostituire il chip ?
6
But isn't variable declaration supposed to be put in header files?
Yes.  But you've put the definitions in the header file.  Definitions belong in the cpp file.

7
Français / Re: Mini pro + mpu6050
Last post by _pepe_ - Today at 10:26 am
Alors j'ai comme infos : tension d'alimentation 6-18v
                                           Courant de travail 350mah
                                           Voltage de travail 11.1v - 16.8v
Un courant est exprimé en A (ampère), ou mA (milliampère). Le mAh (milliampère-heure) est une unité mesurant une charge électrique, typiquement la capacité d'une batterie.

Pour les moteurs, les courants consommés sont spécifiés pour des conditions précises de tension et de vitesse (le courant est plus important à vitesse plus faible et à tension plus élevée).

Pour pouvoir dimensionner les circuits, il faut connaître le courant maximum, correspondant en principe au moteur à l'arrêt, et qui vaut plusieurs fois le courant nominal.

8
why would it blink? you turn it on upon receiving a new message and off until a new message arrives after interval2 ms

with the code you have both should turn on when you get a new message and then through the loop() iterating one goes off after interval1 and the other interval2

if they don't then you might have a power issue for your LED.. do you have power limiting resistors on both pins?
9
I am new to this arduino . I have some basic from arduino Uno and would like to transfer my project to arduino mega2560 because it more suitable for my project due to great number of digital port compare with arduino Uno. So my plan is just to change digital port number with from uno to mega 2560then use the same code which is work fine on uno upload in to mega 2560 . I already did that but somehow there is not thing happens when I supply board with 12VDC 1A power supply . but the LED on board indicated the board is on , so is that possible that anyone can please help me and point out what did I do wrong.

What this project objective

Password lock

First it allow user to set password. Then user input password by keypad. If the password is consistent with set password the relay will closed and led indicator light will be on. Otherwise the relay will open and the led light will be off

Connection

Original connection

LCD
RS -0
R/w - GND
E - 1
D4 - 2
D5 - 3
D6 - 4
D7 - 12
Vss - GND
VDD - 5V
A - 3.3v
K-GND

Keypad (4x4) but we use only 4x3

Row 1 - 11
2- 10
3 - 9
4- 8
Colum 1 - 7
2- 6
3- 5
Relay
S - 13
+ -  = GND

Modified connection

LCD

RS -22
R/w - GND
E - 24
D4 - 26
D5 - 28
D6 - 30
D7 - 46
Vss - GND
VDD - 5V
A - 3.3v
K-GND

Keypad (4x4) but we use only 4x3

Row 1 - 44
2- 42
3 - 40
4- 38

Colum 1 - 36
2- 34
3- 32
Relay
S - 48
+ -  = GND




Original code
[/i][/b]

Code: [Select]
#include <Keypad.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(0, 1, 2, 3, 4, 12);

#define relayPin 13

const byte ROWS = 4; //four rows
const byte COLS = 3; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = { 7, 6, 5}; //connect to the column pinouts of the keypad

int pos = 0;
char secretCode[6] = {'1', '2', '3', '4', '5', '6'};
char inputCode[6] = {'0', '0', '0', '0', '0', '0'};

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup()
{
  lcd.begin(16, 2);
  pinMode(relayPin, OUTPUT);
  //Serial.begin(9600);
  lcd.setCursor(0,0);
  lcd.print("    Welcome!    ");
  delay(2000);
}
void loop()
{
  readKey();
}

void readKey()
{
  int correct = 0;
  int i;
  char customKey = customKeypad.getKey();
  if (customKey)
  {
    switch(customKey)
    {
      case '*':
        pos = 0;
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("Input Your Code:");
      break;
      case '#':   
        for(i = 0; i < 6; i++)
        {
          if(inputCode[i] == secretCode[i])
          {
            correct ++;
          }
        }
        if(correct == 6)
        {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Input correctly!");
          lcd.setCursor(0, 1);
          lcd.print(" Please Come In ");
          digitalWrite(relayPin, HIGH);
          delay(2000);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("    Welcome!    ");
        }
        else
        {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("  Input Error!  ");
          lcd.setCursor(0, 1);
          lcd.print("  Please Again  ");
          digitalWrite(relayPin, LOW);
          delay(2000);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("    Welcome!    ");
        }
      break;
      default:
        inputCode[pos] = customKey;
        lcd.setCursor(pos,1);
        lcd.print(inputCode[pos]);
        pos ++;
    }
  }
}



Modified code on mega (Change Digital pin number)
[/u][/i][/b]

Code: [Select]
#include <Keypad.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(22, 24, 26, 28, 30, 46);

#define relayPin 48

const byte ROWS = 4; //four rows
const byte COLS = 3; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {44, 42, 40, 38}; //connect to the row pinouts of the keypad
byte colPins[COLS] = { 36, 34, 32}; //connect to the column pinouts of the keypad

int pos = 0;
char secretCode[6] = {'1', '2', '3', '4', '5', '6'};
char inputCode[6] = {'0', '0', '0', '0', '0', '0'};

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

void setup()
{
  lcd.begin(16, 2);
  pinMode(relayPin, OUTPUT);
  //Serial.begin(9600);
  lcd.setCursor(0,0);
  lcd.print("    Welcome!    ");
  delay(2000);
}
void loop()
{
  readKey();
}

void readKey()
{
  int correct = 0;
  int i;
  char customKey = customKeypad.getKey();
  if (customKey)
  {
    switch(customKey)
    {
      case '*':
        pos = 0;
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("Input Your Code:");
      break;
      case '#':   
        for(i = 0; i < 6; i++)
        {
          if(inputCode[i] == secretCode[i])
          {
            correct ++;
          }
        }
        if(correct == 6)
        {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Input correctly!");
          lcd.setCursor(0, 1);
          lcd.print(" Please Come In ");
          digitalWrite(relayPin, HIGH);
          delay(2000);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("    Welcome!    ");
        }
        else
        {
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("  Input Error!  ");
          lcd.setCursor(0, 1);
          lcd.print("  Please Again  ");
          digitalWrite(relayPin, LOW);
          delay(2000);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("    Welcome!    ");
        }
      break;
      default:
        inputCode[pos] = customKey;
        lcd.setCursor(pos,1);
        lcd.print(inputCode[pos]);
        pos ++;
    }
  }
}
10
Deutsch / Re: Darf ich um Tipps zur Prog...
Last post by helste - Today at 10:21 am
Was die Codeformatierung anbelangt, so bin ich da sehr penibel. Zumindest habe ich da in meiner gewohnten Programmierumgebung (Delphi, also Object Pascal) meinen Stil und der ist auf gute Lesbarkeit des Codes ausgelegt.

Die Einrückungsstandards in Arduino sind da etwas davon abweichend. So mache ich das z.B. in Delphi so:

Code: [Select]
procedure irgendwas;

begin
if irgendeinebedingung then
   begin
   tuwas;
   end;
end;


ich rücke also immer um 3 Leerrzeichen ein und begin und end sind in der selben Spalte.
Das habe ich dann zu Beginn auch beim Arduino so praktiziert, also in etwa so:

Code: [Select]
loop()
   {
   for(...)
      {
      bla();
      blubb();
      ...
      }
   }


Dann habe ich die Formatierfunktion in der IDE entdeckt und die genutzt und seither halte ich mich da dran. Es wird halt die Blocköffnung in der selben Zeile geschrieben, wie die Bedingung und es wird um 2 Zeichen eingerückt. kann ich damit leben. Ich denke, wenn ich mich an die Standardformatierung halte, ist mein Code noch am ehesten lesbar.

Worum es mir hier geht ist vorallem, dass ich die Eigenheiten der Arduinoprogrammierung nach so kurzer Zeit natürlich noch nicht so kenne und wenn man gleich zu Beginn versucht alles richtig zu machen, dann schleppt man das nicht sein Programmiererleben lang mit.

Deshalb finde ich es super, wenn mein Code hier willkommen ist.

Ich bin gerade dabei ihn besser zu kommentieren und stelle ihn dann rein. Kommentierungen mache ich in Englisch. Nicht weil ich das so gut kann, aber weil ich ein paar internationale Kumpels habe, die dann vielleicht mit meinem Programm arbeiten wollen.


Pages: [1] 2 3 ... 10