Skip to content

A starter project to get Arduino sending data across its serial port to Node.js and then the browser via web sockets.

Notifications You must be signed in to change notification settings

roowilliams/arduino-to-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino to Browser

Arduino to computer interaction

Arduino Script

This is for a hall sensor using an interrupt.

int interruptPin = 2;
bool state = LOW;
bool lastState;

void setup() {
    // runs once
    pinMode(interruptPin, INPUT_PULLUP);
    attachInterrupt(digitalPinToInterrupt(interruptPin), countSpeed, CHANGE);
    Serial.begin(9600);
  }

void loop() {
  // code here runs repeatedly in a loop
  if (state != lastState) {
    Serial.println(state);
    lastState = state;
  }
}

void countSpeed() {
  state = !state;
}

About

A starter project to get Arduino sending data across its serial port to Node.js and then the browser via web sockets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published