GithubHelp home page GithubHelp logo

edison-js / edison Goto Github PK

View Code? Open in Web Editor NEW
42.0 1.0 5.0 330 KB

💡Edison can controll microcomputer with TypeScript and React💡

Home Page: https://edison-js-document.vercel.app/

License: MIT License

TypeScript 97.11% JavaScript 2.89%
iot javascript nodejs robot typescript arduino esp32 robotics-control react

edison's Introduction

Something nice img

Edison

Edison can control microcontroller board with TypeScript or JavaScript!

Documentation

Our documentation site is here!

If you have not yet installed the Arduino IDE ?

please click on the official site and install it.

How to use in WSL

Please read this article.

Installation

Install Edison your project

npm install edison

or

yarn add edison

Getting Started

import { Board, Button, Led, render } from "edison"
import React from "react"

const App: React.FC = () => {
  return (
    <Board port={'/dev/ttyUSB0'}> // Please replace with your port
      <Led
        pin={13}
        blink={500}
      />
    </Board>
  )
}

render(<App />)

Contributing

We love collaborating with folks inside and outside of GitHub and welcome contributions!

👉 Discord

edison's People

Contributors

allenshintani avatar amitkumar-y avatar s1f102201234 avatar yoshihikko-kodaira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

edison's Issues

LED func

The data returned from Arduino may return only f7 at the end if it is not combined.

If two input devices are used, one of them will not work.

(exanple)

import { Board, Button, Led, render } from "edison"
import React from "react"

const App: React.FC = () => {
return (
    <Board port={'/dev/ttyUSB0'}>
      <Button
        pin={9}
        onPress={handlePress}
        onRelease={handleRelease}
      >
        <Led
          pin={5}
          isOn={isOn}
        />
      </Button>

      <InfraredObstacleAvoidance
        pin={12}
        onPress={handlePress1}
        onRelease={handleRelease1}
      >
        <Led
          pin={13}
          isOn={isOn1}
        />
      </InfraredObstacleAvoidance>
    </Board>
  )
}

render(<App />)

import error

Error when testing with Vitest

Error: Cannot find module '/home/runner/work/memorial-cycle/memorial-cycle/server/node_modules/edison/dist/esm/utils/board' imported from /home/runner/work/memorial-cycle/memorial-cycle/server/node_modules/edison/dist/esm/index.mjs

add ultrasonic sensor

Ultrasonic sensors can send ultrasonic waves and measure distance in the time it takes to receive them.
However, JS(TS) may not know how to measure microseconds accurately and may not be able to obtain the correct distance.

Please find a way to make it work correctly.

Add error handling to components other than parent and child

import React from 'react'
import { useState } from 'react'
import { Board } from '../utils/Board'
import { render } from '../rendere/render'
import { Button } from '../components/input/Button'
import { Led } from '../components/output/Led'

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

  return (
    <Board port={'/dev/ttyUSB0'}>
      <Button
        pin={8}
        triggered={() => setIsOn(true)}
        untriggered={() => setIsOn(false)}
      >
        <Led
          pin={13}
          isOn={isOn}
        />
      </Button>
      <Button
        pin={12}
        triggered={() => setIsOn1(true)}
        untriggered={() => setIsOn1(false)}
      >
        <Led
          pin={4}
          isOn={isOn1}
        />
      </Button>
    </Board>
  )
}
render(<App />)

Error handling for the above code that can manipulate relationships other than parent-child if setIsOn and setIsOn1 of triggered are swapped.
if change the handle "isOn" and "isOn1" state, you can controll led state other than parent and child components.

Support Arduino NANO Every

  • The MANUFACTURER is not Arduino even if it is a legitimate product (friendlyName contains Arduino).
  • The hall sensor responds twice at one time, whether it is because I am using connectManual in the above response or because the sensor is over-reacting.

image

Allows operation via declarative UI

Currently, Edison can be operated with procedural processing.
In the future We would like to be able to operate Edison with a declarative UI.

We need someone to help us. We imagine the following code.
image

Add Contributing.md file

I suggest adding a contributing.md file to the project. You can assign this task to me, and I will create the file

Add a repository information about

Suggestions

I propose adding a brief description of the repository's functionality and a direct link to the documentation (https://edison-js-document.vercel.app/) on the "About" page. This will provide a clearer understanding of the repository's purpose and offer easy access to the documentation.

Here is the suggestion for bio

  • TypeScript for Arduino
  • Arduino programming with TypeScript

Feel free to adjust the bio as needed; these are just suggestions to provide more context about what the repository offers.

Error on input sensor

The infrared sensor is working properly, but the program is not returning the correct value.

import { SerialPort, attachHallEffectSensor, attachLed, board } from "edison";

board.connectManual("/dev/ttyUSB0");

board.on("ready", (port: SerialPort) => {
  console.log("Board is ready!");
  const led1 = attachLed(port, 13);

  const infraredObstacleAvoidanceSensor = attachHallEffectSensor(port, 3);
  infraredObstacleAvoidanceSensor.read("on", () => {
    led1.on();
    console.log(1);
  });
  infraredObstacleAvoidanceSensor.read("off", () => {
    led1.off();
    console.log(0);
  });
});

In the above code, when the sensor is on, the value 0 may be output.

Add joystickSensor

For joystick implementation.
・Multiple control of analog pins.
・Get analog messages on a pin-by-pin basis
・Built-in Buttons

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.