How to read from ATmega328P with Raspberry Pi



  • I have compiled and flashed following program to the atmega328P (connected to a raspberry pi). This program reads a voltage on pin. A0

    ============================Begin program================================
    const int analogInPin = A0;

    float sensorValue = 0;

    void setup(){
    Serial.begin(9600);
    }

    void loop() {
    sensorValue = analogRead(analogInPin);

    Serial.print(¨Voltage Output = ");
    Serial.print(sensorValue*5/1023);
    Serial.println(" ");
    
    delay(100);
    

    }
    ===============================End program================================

    I only use the command line in the raspberry pi. (no GUI)

    When I've flashed the program I get the command prompt back.
    Q: How do I read the values of the program in the atmega328p back in my raspberry pi?


  • Contest Winner

    @henkoegema

    are they connected via Serial TX/RX?



  • Connected via SPI (MOSI, MISO,.....etc)


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 9
  • 5
  • 1
  • 3

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts