|
www.elektronik.si Forum o elektrotehniki in računalništvu
|
Poglej prejšnjo temo :: Poglej naslednjo temo |
Avtor |
Sporočilo |
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Tor Jan 26, 2016 2:28 pm Naslov sporočila: Arduino spot welder |
|
|
Ce mi lahko kdo pomaga delam spot welser z arduinotom in mi nagaja program. pokace se napaka v programu. ta program sem našel na te internetni strani https://endless-sphere.com/forums/viewtopic.php?f=6&t=61046
#include "switch.h"
compilation terminal
exit status 1
error compiling
Koda: |
/*
Arduino resistance spot welder timer
Copyright (C) 2012 Albert van Dalen http://www.avdweb.nl
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses .
Version 10-9-2013
Guillaume de Bailliencourt (Cybug) : Add support for menu with push buttons and display.
*/
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
//#include <Streaming.h>
#include "switch.h"
// using LiquidCrystal library
#include <LiquidCrystal.h>
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
const byte spotWelderButtonPin = 52;
const byte spotWelder = 53;
bool continuousWelding = 0; // enable continuous welding
bool startWelding = 0;
unsigned long startWeldTime = 0;
int iterWeld = 0;
int preWeld_ms = 50;
int step_ms = 150;
int weldPause = 500;
int tSelect = 3;
Switch spotWelderButton(spotWelderButtonPin);
void setup()
{ Serial.begin(9600);
pinMode(spotWelder, OUTPUT);
lcd.begin(16, 2); // start the library
updateDisplay(0);
}
void loop()
{
spotWelderButton.poll();
if(continuousWelding) weld(spotWelderButton.on());
else
if(spotWelderButton.pushed()) weldCyclus(step_ms);
//lcd.setCursor(0,1); // move to the begining of the second line
lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key) // depending on which button was pushed, we perform an action
{
case btnRIGHT:
if (!continuousWelding) {
tSelect += 1;
if (tSelect >=4) tSelect = 1;
updateDisplay(300);
//lcd.print("RIGHT ");
}
break;
case btnLEFT:
if (!continuousWelding) {
tSelect -= 1;
if (tSelect <=0) tSelect = 3;
updateDisplay(300);
//lcd.print("LEFT ");
}
break;
case btnUP:
if (!continuousWelding) {
if (tSelect == 1)
preWeld_ms += 1;
else if (tSelect == 2)
weldPause += 50;
else
step_ms += 10;
updateDisplay(300);
//lcd.print("UP ");
}
break;
case btnDOWN:
if (!continuousWelding) {
if (tSelect == 1)
preWeld_ms -= 1;
else if (tSelect == 2)
weldPause -= 50;
else
step_ms -= 10;
updateDisplay(300);
//lcd.print("DOWN ");
}
break;
case btnSELECT:
{
continuousWelding = !continuousWelding;
updateDisplay(300);
//lcd.print("SELECT");
break;
}
case btnNONE:
{
//lcd.print("NONE ");
break;
}
}
}
void updateDisplay(int ms_delay)
{
lcd.setCursor(0,0);
if (continuousWelding)
{
lcd.print(" Welding while ");
lcd.setCursor(0,1);
lcd.print(" pressing pedal ");
delay(ms_delay);
return;
}
if (tSelect == 1)
lcd.print("<Pre>Pause Weld ");
else if (tSelect == 2)
lcd.print(" Pre<Pause>Weld ");
else
lcd.print(" Pre Pause<Weld>");
lcd.setCursor(1,1);
lcd.print(" ");
lcd.setCursor(1,1);
lcd.print(preWeld_ms);
lcd.setCursor(5,1);
lcd.print(" ");
lcd.setCursor(5,1);
lcd.print(weldPause);
lcd.setCursor(11,1);
lcd.print(" ");
lcd.setCursor(11,1);
lcd.print(step_ms);
delay(ms_delay);
}
void weldCyclus(int weldTime_ms)
{
lcd.setCursor(0,0);
lcd.print(" << WELDING >> ");
//lcd.setCursor(0,1);
//lcd.print(">");
pulseSpotWelder(preWeld_ms);
/*
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(4,1);
lcd.print(">");
*/
delay(weldPause);
/*
lcd.setCursor(4,1);
lcd.print(" ");
lcd.setCursor(10,1);
lcd.print(">");
*/
pulseSpotWelder(weldTime_ms);
//lcd.setCursor(10,1);
//lcd.print(" ");
updateDisplay(0);
}
void weld(bool b)
{ digitalWrite(spotWelder, b);
if (b)
{
lcd.setCursor(0,0);
lcd.print(" << WELDING >> ");
if (startWelding != b)
{
startWeldTime = millis();
startWelding = b;
lcd.setCursor(0,1);
lcd.print(" ");
}
if ((iterWeld++ % 50) == 0)
{
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(millis() - startWeldTime);
lcd.print("ms");
}
}
else
{
startWelding = 0;
iterWeld = 0;
updateDisplay(0);
}
}
void pulseSpotWelder(int ms)
{ digitalWrite(spotWelder, 1);
delay(ms);
digitalWrite(spotWelder, 0);
//Serial << ms << endl;
}
// read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // read the value from the sensor
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741
// we add approx 50 to those values and check to see if we are close
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
// For V1.0 use the one below:
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
return btnNONE; // when all others fail, return this...
} |
|
|
Nazaj na vrh |
|
|
Jaka57 Moderator
Pridružen-a: Ned 12 Dec 2004 21:47 Prispevkov: 5773 Aktiv.: 25.91 Kraj: Grosuplje
|
Objavljeno: Tor Jan 26, 2016 9:06 pm Naslov sporočila: |
|
|
Tako na hitro se mi zdi da manjka knjižnjica switch.
_________________ Lp, Jaka
Nazadnje urejal/a Jaka57 Tor Jan 26, 2016 9:30 pm; skupaj popravljeno 1 krat |
|
Nazaj na vrh |
|
|
solomojster Član
Pridružen-a: Tor 18 Maj 2010 12:26 Prispevkov: 845 Aktiv.: 4.99 Kraj: NOVA GORICA
|
|
Nazaj na vrh |
|
|
Jaka57 Moderator
Pridružen-a: Ned 12 Dec 2004 21:47 Prispevkov: 5773 Aktiv.: 25.91 Kraj: Grosuplje
|
Objavljeno: Tor Jan 26, 2016 9:39 pm Naslov sporočila: |
|
|
Bo kar tole.
_________________ Lp, Jaka |
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Tor Jan 26, 2016 10:14 pm Naslov sporočila: |
|
|
Hvala za pomoč!
sedaj pa imam se en problem javi mi to napako ko je na sliki. Če mi lahko kdo pomaga.
lp
denis
Opis: |
|
Velikost datoteke: |
86.52 KB |
Pogledana: |
69 krat |
|
|
|
Nazaj na vrh |
|
|
Jaka57 Moderator
Pridružen-a: Ned 12 Dec 2004 21:47 Prispevkov: 5773 Aktiv.: 25.91 Kraj: Grosuplje
|
Objavljeno: Sre Jan 27, 2016 9:54 am Naslov sporočila: |
|
|
Pravilno nisi skopiral switch.cpp in switch.h.
V priponki imaš kompletno mapo, razpakiraj jo v \Moji dokumenti\Arduino\libraries, lahko pa jo razpakiraš kamorkoli in uvoziš preko Arduino IDE Skica->Uvozi knjižnjico in pokaži mapo Switch.
Meni prevede tvojo skico brez problemov (v.1.5.2 r2 in v.1.6.1).
Opis: |
|
Velikost datoteke: |
116.33 KB |
Pogledana: |
16 krat |
|
Opis: |
|
Download |
Ime datoteke: |
Switch.rar |
Velikost datoteke: |
2.43 KB |
Downloadano: |
5 krat |
_________________ Lp, Jaka |
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Tor Jun 28, 2016 10:45 pm Naslov sporočila: |
|
|
Če koga zanima sem naredil in dela fatastično.
|
|
Nazaj na vrh |
|
|
solomojster Član
Pridružen-a: Tor 18 Maj 2010 12:26 Prispevkov: 845 Aktiv.: 4.99 Kraj: NOVA GORICA
|
Objavljeno: Sre Jun 29, 2016 6:32 am Naslov sporočila: |
|
|
Doki$ je napisal/a: |
Če koga zanima sem naredil in dela fatastično. |
Nas zelo zanima. Lahko posnameš kratek video ?
|
|
Nazaj na vrh |
|
|
Jaka57 Moderator
Pridružen-a: Ned 12 Dec 2004 21:47 Prispevkov: 5773 Aktiv.: 25.91 Kraj: Grosuplje
|
Objavljeno: Sre Jun 29, 2016 10:56 am Naslov sporočila: |
|
|
Doki$ je napisal/a: |
Če koga zanima sem naredil in dela fatastično. |
Seveda nas zanima! Lahko se pohvališ s kakšno sliko ali albumom slik, če že ne s kratkim video posnetkom.
_________________ Lp, Jaka |
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Sre Jun 29, 2016 1:21 pm Naslov sporočila: |
|
|
Bom čim prej dal kakšno sliko, kasneje pa kakšen posnetek.
|
|
Nazaj na vrh |
|
|
Jaka57 Moderator
Pridružen-a: Ned 12 Dec 2004 21:47 Prispevkov: 5773 Aktiv.: 25.91 Kraj: Grosuplje
|
Objavljeno: Sre Jun 29, 2016 2:19 pm Naslov sporočila: |
|
|
Doki$ je napisal/a: |
Bom čim prej dal kakšno sliko, kasneje pa kakšen posnetek. |
Odlično!
_________________ Lp, Jaka |
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Čet Jun 30, 2016 7:24 am Naslov sporočila: |
|
|
slike
Opis: |
|
Velikost datoteke: |
2.59 MB |
Pogledana: |
39 krat |
|
|
|
Nazaj na vrh |
|
|
Doki$ Član
Pridružen-a: Čet 16 Jul 2009 7:49 Prispevkov: 12 Aktiv.: 0.07 Kraj: LJUBLJANA
|
Objavljeno: Čet Jun 30, 2016 7:27 am Naslov sporočila: |
|
|
Še ena
Opis: |
|
Velikost datoteke: |
3.23 MB |
Pogledana: |
27 krat |
|
|
|
Nazaj na vrh |
|
|
|
|
Ne, ne moreš dodajati novih tem v tem forumu Ne, ne moreš odgovarjati na teme v tem forumu Ne, ne moreš urejati svojih prispevkov v tem forumu Ne, ne moreš brisati svojih prispevkov v tem forumu Ne ne moreš glasovati v anketi v tem forumu Ne, ne moreš pripeti datotek v tem forumu Ne, ne moreš povleči datotek v tem forumu
|
Uptime: 69 dni
Powered by phpBB © 2001, 2005 phpBB Group
|