Skip to main content

Hall Effect Sensor

1. Write standard firmata to the device

Uploading Standard Firmata to Arduino Open Arduino IDE. File > Examples > Firmata > StandardFirmata.

Tools > Board > your board Tools > Serial Port > your port Click Upload button. if you use WSL, you need to follow this

2. Run the Hall effect sensor

index.tsx
import { Board, Led, HallEffectSensor, render} from "edison"
import React, {useState} from "react"

const App: React.FC = () => {
const [isOn, setIsOn] = useState(false)

return (
<Board port={'/dev/tty***'} baudRate={57600}>
<HallEffective
pin={8}
triggered={() => setIsOn(true)}
untriggered={() => setIsOn(false)}
>
<Led
pin={13}
isOn={isOn}
/>
</HallEffective>
</Board>
)
}
render(<App />)

This program will blink the LED when the hall effect sensor is run.

3. execute the program

$ npx vite-node index.tsx 

You can use <HallEffective >

PropsTypeDescriptionDefault
pinnumberPin number to control currentNone
triggered?(() => void)Pin number to control currentNone
untriggered?(() => void)Pin number to control currentNone
childrenReact.ReactNodeChild components such as outbutNone