Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. How to read from ATmega328P with Raspberry Pi

How to read from ATmega328P with Raspberry Pi

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • henkoegemaH Offline
    henkoegemaH Offline
    henkoegema
    wrote on last edited by
    #1

    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?

    BulldogLowellB 1 Reply Last reply
    0
    • henkoegemaH henkoegema

      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?

      BulldogLowellB Offline
      BulldogLowellB Offline
      BulldogLowell
      Contest Winner
      wrote on last edited by
      #2

      @henkoegema

      are they connected via Serial TX/RX?

      1 Reply Last reply
      0
      • henkoegemaH Offline
        henkoegemaH Offline
        henkoegema
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        13

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular