Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skittleson/ESP-TypeScript
Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.
https://github.com/skittleson/ESP-TypeScript
esp32 esp8266 javascript typescript
Last synced: 2 months ago
JSON representation
Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.
- Host: GitHub
- URL: https://github.com/skittleson/ESP-TypeScript
- Owner: skittleson
- Created: 2022-03-02T07:50:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-18T19:42:06.000Z (over 2 years ago)
- Last Synced: 2024-08-02T13:34:50.599Z (6 months ago)
- Topics: esp32, esp8266, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 1.92 MB
- Stars: 162
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# ESP-TypeScript
> Transpile TypeScript to [Espruino](https://github.com/espruino/Espruino) flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.
## Install
```sh
npm install
```## Usage
Adjust port used in `package.json` then:
```sh
npm run-script transpile
```Permanently save transpile code on device.
```sh
npm run-script commit
```Monitor serial responses
```sh
npm run-script monitor
```## Run tests
```sh
npm test
```Code coverage in `coverage/index.html`
## Example
The simplest example in `blinky.ts`. Blink a LED.
```typescript
const BUILTIN_LED = 2;
export function blinkly(intervalMs: number = 2000, pin: number = BUILTIN_LED) {
let toggleStatus = false;
setInterval(function () {
toggleStatus = !toggleStatus;
digitalWrite(pin, toggleStatus);
}, intervalMs);
}
```More advance example using a class, properties, testing using mocks and type checking: `AdvanceBlinky` class in [advanceBlinky.ts](src/advanceBlinky.ts) with test at [test/blinky.spec.ts](test/blinky.spec.ts).
In depth documentation about [Espruino JavaScript API and flashing](https://www.espruino.com/Reference#software)
## Road map
- [x] Transpile TypeScript to Espruino flavor of JavaScript
- [x] Example usage of typed code
- [x] Short commands to build, upload, and monitor
- [x] Unit testing
- [x] Firmware guidance docs
- [ ] Integration testing## Devices
[Firmware selections](http://www.espruino.com/Download)
[ESP8266](https://amzn.to/3vA67By)
[![Wemos D1 mini ESP8266](original.jpg)](https://amzn.to/3vA67By)[ESP32](https://amzn.to/3Ml7Znx)
[![Wemos ESP32](esp32.jpg)](https://amzn.to/3Ml7Znx)These devices are also know to work: [https://templates.blakadder.com/](https://templates.blakadder.com/)
## Author
👤 **Spencer Kittleson**
- Website: https://docodethatmatters.com
- Twitter: [@skittleson](https://twitter.com/skittleson)
- Github: [@skittleson](https://github.com/skittleson)
- LinkedIn: [@skittleson](https://linkedin.com/in/skittleson)## Show your support
Give a ⭐️ if this project helped you!