Skip to content

Commit

Permalink
removed dcokerfile and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-488 committed Mar 22, 2024
1 parent 77ba95d commit c8eb022
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
This is an extension of [Edrys-Module-Code](https://github.com/Cross-Lab-Project/edrys_module-editor), that makes the code editor able to connect to a server using WebSockets so it can send/receive data.

Use this URL to add the module to your class:

```
https://jh-488.github.io/Edrys_Code_Editor/index.html
```

## Differences from the original Editor

1. The client can now connect to a server running on localhost and send the code within it to the server (When the "Run Code" button is clicked)
1. The client can now connect to a server running on localhost and send the code and port name to the server (When the "Run Code" button is clicked)

```js
{
Expand All @@ -19,19 +20,30 @@ Use this URL to add the module to your class:
Edrys.onMessage(({ from, subject, body }) => {
...

// send the code through socket
socket.send(body);
// Get port name from the input field
const portName = document.getElementById("port_input").value;

// send the code and the port name through socket if connected
if(portName.length === 0) {
displayMessage("Please enter a port name!!")
}
else if(!socket || socket.readyState !== WebSocket.OPEN ) {
displayMessage("Error: Server not connected!!");
} else {
socket.send(JSON.stringify({
code: body,
port: portName
}));
}
}
```
2. A NodeJS server that can be run locally to start the connection. When the data (code) is received from the client, it will store it in an ".ino" file, compile it and upload it to the board.
2. A NodeJS server that can be run locally to start the connection. When the data (code and port name) is received from the client, it will store the code in an ".ino" file, compile it and upload it to the board.
To run the server locally :
* Clone this repo and cd to /server
* npm install
* node ./index.js --port "port-name" \
(e.g. node .\index.js --port COM4)
- Clone this repo and cd to /server
- npm install
- npm run server
PS: [Arduino CLI](https://arduino.github.io/arduino-cli/0.35/installation/) with your platform core should be installed on your local machine.
PS: [Arduino CLI](https://arduino.github.io/arduino-cli/0.35/installation/) with your platform core should be installed on your local machine.
26 changes: 0 additions & 26 deletions server/Dockerfile

This file was deleted.

0 comments on commit c8eb022

Please sign in to comment.