Σελίδα 2 από 2 ΠρώτηΠρώτη 1 2
Εμφάνιση αποτελεσμάτων : 11 έως 15 από 15

Θέμα: AZIMUT AND ELEVATION με ΑtMega 328P

  1. #11
    Μέλος
    Εγγραφή
    Dec 2004
    Μηνύματα
    1.422

    Προεπιλογή

    αμεση απάντηση αψογος
    αλλα ισως κάτι δεν κάνω σωστά και μου βγάζει αυτό
    1.JPG

    0 Not allowed! Not allowed!
    ...

  2. #12
    Μέλος Το avatar του χρήστη manolena
    Όνομα
    Μάνος
    Εγγραφή
    Dec 2006
    Περιοχή
    Ελευσίνα
    Μηνύματα
    2.709

    Προεπιλογή

    Δεν το μελέτησα καθόλου για να είμαι ειλικρινής, διορθώνω, σε 5'

    0 Not allowed! Not allowed!

  3. #13
    Μέλος Το avatar του χρήστη manolena
    Όνομα
    Μάνος
    Εγγραφή
    Dec 2006
    Περιοχή
    Ελευσίνα
    Μηνύματα
    2.709

    Προεπιλογή

    Κώδικας:
    /* hey, this is a simple code to make your arduino read
    the value of a potentiometer and display it in percentage form on
    a 16 X 2 LCD screen. I am pretty new at this so sorry if this code
    is terrible or if i have no idea what i'm talking about in the
    comments.
    
    
    the circuit(pasted from examples):
    
    
    * LCD RS pin to digital pin 12
    * LCD Enable pin to digital pin 11
    * LCD D4 pin to digital pin 5
    * LCD D5 pin to digital pin 4
    * LCD D6 pin to digital pin 3
    * LCD D7 pin to digital pin 2
    * LCD R/W pin to ground
    * 10K resistor:
    * ends to +5V and ground
    * wiper to LCD VO pin (pin 3)
    * Potentiometer attached to analog input 0
    * Potentiometer attached to analog input 1
    
    
    * center pin of the potentiometer to the analog pin
    * one side pin (either one) to ground
    * the other side pin to +5V
    
    
    */
    //=======================================================================INCLUDES
    #include <LiquidCrystal.h> // include the LCD library
    
    
    //=======================================================================DEVICE SETUP
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    //=======================================================================VARIABLES
    int potPin = A0; //Potentiometer input pin
    int potValue1 = 0;
    int potValue2 = 0; // final display variable
    int poLPin = A1; //Potentiometer input pin
    int poLValue3 = 0;
    int poLValue4 = 0; // final display variable
    
    
    //=======================================================================SETUP
    void setup() 
    {
      lcd.begin(16, 2); // lcd rows and columns
      // set up the LCD's number of columns and rows:
      // Print a message to the LCD.
      lcd.print("Rotor Controller");
      delay(5500);
      lcd.clear();
    }
    //=======================================================================MAIN LOOP
    void loop() 
    {
      // read then divide the input(max 1020 in this case) by 10
      potValue1 = analogRead(potPin) / 1.87;
      // divide by 1.02 to get percentage
      potValue2 = potValue1 / 1;
      
      if(potValue2<10)
      {
        lcd.setCursor(0,0);
        lcd.print("00");
        lcd.print(potValue2);
      }
      else if((potValue2>9) && (potValue2<100))
      {
        lcd.setCursor(0,0);
        lcd.print("0");
        lcd.print(potValue2);
      }
      else if(potValue2>99)
      {
        lcd.setCursor(0,0);
        lcd.print(potValue2);
      }  
      //print the percent symbol at the end
      lcd.print((char)223);
      lcd.print(" Azimuth");
    //=======================================================================  
      // read then divide the input(max 1020 in this case) by 10
      poLValue3 = analogRead(poLPin) / 7.48;
      // divide by 1.02 to get percentage
      poLValue4 = poLValue3 / 1;
      // set cursor to second row, first column   
      
      if(poLValue4<10)
      {
        lcd.setCursor(0,1);
        lcd.print("00");
        lcd.print(poLValue4);
      }
      else if((poLValue4>9) && (poLValue4<100))
      {
        lcd.setCursor(0,1);
        lcd.print("0");
        lcd.print(poLValue4);
      }
      else if(poLValue4>99)
      {
        lcd.setCursor(0,1);
        lcd.print(poLValue4);
      }
      //print the percent symbol at the end
      lcd.print((char)223);
      lcd.print(" Elevation");
      //wait 0.1 seconds
      delay(100);
      //wipe the extra characters
      lcd.print(" ");
      delay(1);
    }
    Τώρα είσαι ΟΚ, χτίζεται κανονικά.

    1 Not allowed! Not allowed!

  4. Ένα μέλος ευχαρίστησε τον manolena για αυτό το χρήσιμο μήνυμα:

    jimnaf (25-01-14)

  5. #14
    Μέλος
    Εγγραφή
    Dec 2004
    Μηνύματα
    1.422


    0 Not allowed! Not allowed!
    ...

  6. #15
    Μέλος
    Εγγραφή
    Dec 2004
    Μηνύματα
    1.422

    Προεπιλογή

    αυτο με τα servo νομιζω οτι θα μπορούσε να γίνει και με τα ποτενσιόμετρα και τον ηδη υπάρχων κινητήρα (μοτέρ) τι λες

    0 Not allowed! Not allowed!
    ...

Σελίδα 2 από 2 ΠρώτηΠρώτη 1 2

Παρόμοια Θέματα

  1. Απαντήσεις: 8
    Τελευταίο Μήνυμα: 28-01-16, 11:14
  2. atmega συμβατότητα
    By NOE in forum Μικροελεγκτές
    Απαντήσεις: 2
    Τελευταίο Μήνυμα: 02-05-14, 22:16
  3. Ερωτηση για ATMEGA 328P-PU (Arduino)
    By furtune in forum Μικροελεγκτές
    Απαντήσεις: 6
    Τελευταίο Μήνυμα: 21-07-11, 20:43
  4. μΕ Atmega on breadboard
    By xmaze in forum Ηλεκτρονικά
    Απαντήσεις: 6
    Τελευταίο Μήνυμα: 06-09-10, 03:13
  5. ATMega + ENC28J60 :)
    By PiCBuRn3r in forum Παρουσίαση Ολοκληρωμένων Κατασκευών
    Απαντήσεις: 13
    Τελευταίο Μήνυμα: 13-10-08, 11:04

Δικαιώματα - Επιλογές

  • Δημιουργία θεμάτων: Όχι
  • Υποβολή μηνυμάτων: Όχι
  • Σύναψη αρχείων: Όχι
  • Επεξεργασία μηνυμάτων: Όχι
  •  
  • BB code: σε λειτουργία
  • Smilies: σε λειτουργία
  • [IMG]: σε λειτουργία
  • [VIDEO] code is σε λειτουργία
  • HTML: εκτός λειτουργίας