Skip to content

KOSASIH/pi-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Badge CI DeepSource

pi-node by KOSASIH is licensed under Creative Commons Attribution 4.0 International

pi-node

This repository contains the source code for a simple Node.js application that runs on a Raspberry Pi. The application listens for incoming HTTP requests and responds with a message indicating the current temperature and uptime of the Raspberry Pi.

Prerequisites

To run this application, you will need the following:

  1. A Raspberry Pi with Node.js installed
  2. A temperature sensor (such as a DS18B20) connected to the Raspberry Pi

Getting Started

  1. Clone this repository to your Raspberry Pi:
git clone https://github.com/KOSASIH/pi-node.git
  1. Install the required dependencies:
cd pi-node
npm install
  1. Edit the config.js file to specify the temperature sensor's device file path. For example, if you're using a DS18B20 connected to GPIO pin 4, the device file path will be /sys/bus/w1/devices/28-000005f8b8ff/w1_slave.

  2. Start the application:

npm start
  1. Use a web browser or a tool like curl to send an HTTP request to the Raspberry Pi and view the response:
curl http://<RASPBERRY_PI_IP_ADDRESS>:3000

The response will look something like this:

Temperature: 23.5°C, Uptime: 1 day, 2 hours, 34 minutes, 56 seconds

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Source code for a simple Node.js application that runs on a Raspberry Pi.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%