Jump to content
ELFORUM - Forumul electronistilor

ain

Membru activ
  • Content Count

    218
  • Joined

  • Last visited

Community Reputation

5 Neutral

About ain

Profile Information

  • Locatie
    Cj

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Multumesc mult pentru interventie. M-am uitat cu atentie peste program si am realizat ca foloseam comenzi ce nu aveau ce cauta acolo (digitalwrite). Acum partea asta de program functioneaza bine. Il voi folosi sa masor/calibrez senzorul de temperatura (probabil NTC) si in functie de functia de masurare a temperaturi voi gandi partea electronica pentru masurarea acesteia. Inca o data, multumesc. #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> #define BACKLIGHT_PIN 3 const byte ONOFFbuttonPin = 8; const byte INCbuttonPin = 6; const byte DECbuttonPin = 7; const byte CommandLedPin = 9; const byte PWMMax = 50; int ONOFFbuttonState = 0; int INCbuttonState = 0; int DECbuttonState = 0; byte PWMVal = 0; LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); // set the LCD address to 0x3F for a 16 chars and 2 line display void setup() { lcd.begin(16,2); lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); // go home pinMode(CommandLedPin, OUTPUT); pinMode(ONOFFbuttonPin, INPUT); pinMode(INCbuttonPin, INPUT); pinMode(DECbuttonPin, INPUT); TCCR1A = _BV(COM1A1) | _BV(WGM11); // Enable the PWM output OC1A on digital pins 9 TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS12) | _BV(CS10); // Set fast PWM and prescaler of 1024 on timer 1 ICR1 = 31249; // Set the PWM frequency to 0.5Hz: 16MHz/(1024 * 0.5Hz) - 1 = 31249 OCR1A = PWMVal*312.49; // Set the duty-cycle to X%: ICR1 * X / 100 } void loop() { lcd.setCursor(0,1); lcd.print("PWM"); lcd.setCursor(4,1); lcd.print(PWMVal); lcd.print("% "); ONOFFbuttonState = digitalRead(ONOFFbuttonPin); INCbuttonState = digitalRead(INCbuttonPin); DECbuttonState = digitalRead(DECbuttonPin); if (INCbuttonState == LOW && PWMVal<PWMMax) { lcd.setCursor(13,0); lcd.print("Inc"); PWMVal += 1; OCR1A = PWMVal*312.49; } else { if (DECbuttonState == LOW && PWMVal>0) { lcd.setCursor(13,0); lcd.print("Dec"); PWMVal -= 1; OCR1A = PWMVal*312.49; } else { lcd.setCursor(13,0); lcd.print(" "); } } delay(150); }
  2. Buna, Incerc sa transform o masina de facut paine intr-un termostat cu temperatura reglabila. Voi folosi un UNO care comanda rezistenta de incalzire printr-un optotriac S21ME6 (cu detectie trecere prin zero) si un triac de putere. Deocamdata vreau sa testez doar partea de comanda a puterii. Comanda vreau sa o fac PWM cu o perioada de 2s, coeficientul de umplere reglabil undeva intre 0 si o valoare maxima de 50%. Am scris un softulet care permite alegerea valorii factorului de umplere prin apasarea a 2 butoane. Partea de modificare a coef. de umplere functioneaza corect (PWMVal este calculata corect), insa am probleme cu comanda spre portul digital de iesire (portul digital 9 nu are coeficientul de umplere variabil dorit, ci ramane la valoarea initializata in setup.. N-am mai programat ceva serios in C de 20 de ani; gresesc ceva, si nu stiu unde. Stiu sa fac cu ajutorul functiei delay, insa doresc ceva cu intreruperi care sa functioneze independent de programul de termostatare care urmeaza sa fie implementat. Orice ajutor va fi apreciat. Eventual o alta solutie. Multumesc anticipat. #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> #define BACKLIGHT_PIN 3 const int ONOFFbuttonPin = 8; const int INCbuttonPin = 6; const int DECbuttonPin = 7; const int CommandLedPin = 9; const int PWMMax = 50; int ONOFFbuttonState = 0; int INCbuttonState = 0; int DECbuttonState = 0; int PWMVal = 0; LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7); // set the LCD address to 0x3F for a 16 chars and 2 line display void setup() { PWMVal = 0; lcd.begin(16,2); lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); lcd.home (); // go home pinMode(CommandLedPin, OUTPUT); // Set digital pin 9 (D9) to an output pinMode(ONOFFbuttonPin, INPUT); pinMode(INCbuttonPin, INPUT); pinMode(DECbuttonPin, INPUT); // pinMode(9, OUTPUT); TCCR1A = _BV(COM1A1) | _BV(WGM11); // Enable the PWM output OC1A on digital pins 9 TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS12) | _BV(CS10); // Set fast PWM and prescaler of 1024 on timer 1 ICR1 = 31249; // Set the PWM frequency to 0.5Hz: 16MHz/(1024 * 0.5Hz) - 1 = 31249 OCR1A = PWMVal*312.49; // Set the duty-cycle to 10%: 124999 / 10 = 12499 } void loop() { lcd.setCursor(0,1); lcd.print("PWM"); lcd.setCursor(4,1); lcd.print(PWMVal); lcd.print("% "); ONOFFbuttonState = digitalRead(ONOFFbuttonPin); INCbuttonState = digitalRead(INCbuttonPin); DECbuttonState = digitalRead(DECbuttonPin); if (INCbuttonState == LOW && PWMVal<PWMMax) { digitalWrite(CommandLedPin, HIGH); lcd.setCursor(13,0); lcd.print("Inc"); PWMVal += 1; lcd.setCursor(10,1); lcd.print(OCR1A); lcd.print(" "); } else { if (DECbuttonState == LOW && PWMVal>0) { digitalWrite(CommandLedPin, HIGH); lcd.setCursor(13,0); lcd.print("Dec"); PWMVal -= 1; lcd.setCursor(10,1); lcd.print(OCR1A); lcd.print(" "); } else { digitalWrite(CommandLedPin, LOW); lcd.setCursor(13,0); lcd.print(" "); } } delay(300); }
  3. Intrebare de amator: oare stratul ala ce acopera calajul de cupru e pus acolo sa ascunda schema sau are un rol? O fi avand legatura cu tensiunea mare necesara la tuburi?
  4. Sau dintr-o unitate DVD/RW sau CD/RW. Pentru inscriptionare se foloseste un laser rosu de 30-70 mW.
  5. Neplaneitatea se poate rezolva prin utilizarea unui firmware care face aceasta corectie. Marlin foloseste un senzor inductiv/capacitiv/mecanic specializat si examineaza patul imprimantei in 9 puncte. E free, opensource, si il gasesti gata compilat pentru mai toate imprmantele 3D. http://marlinfw.org/
  6. Poti incepe de aici: https://circuitdigest.com/electronic-circuits/simulate-speaker-with-equivalent-rlc-circuit
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines