├── .github
└── FUNDING.yml
├── LICENSE
├── README.md
├── main.js
└── package.json
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [Furtsy]
2 | ko_fi: furtsy
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Furtsy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [](https://www.youtube.com/watch?v=LwxyHwsbQwo "Arduino'yu discordan yönetmek || Managing Arduino from discord")
4 |
Discord Server | Discord Sunucum 5 | Project İmage 6 |7 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | const client = new Discord.Client(); 3 | const { 4 | Board, 5 | Thermometer, 6 | Led, 7 | Piezo 8 | } = require("johnny-five"); 9 | const AsciiTable = require("ascii-table"); 10 | const board = new Board(); 11 | board.on("ready", () => { 12 | const led = new Led(13); 13 | const piezo = new Piezo(3); 14 | const thermometer = new Thermometer({ 15 | controller: "LM35", 16 | pin: "A0" 17 | }); 18 | 19 | client.on('message', msg => { 20 | const { 21 | celsius, 22 | fahrenheit, 23 | kelvin 24 | } = thermometer; 25 | if (msg.content === "led-open") return led.on() 26 | if (msg.content === "led-close") return led.off() 27 | if (msg.content === "weather-degrees") { 28 | var table = new AsciiTable() 29 | table 30 | .addRow('°C:', celsius) 31 | .addRow('°F:', fahrenheit) 32 | .addRow('K:', kelvin) 33 | let embed = new Discord.MessageEmbed() 34 | .setDescription(`\`\`\`${table.toString()}\`\`\``) 35 | msg.channel.send(embed) 36 | } else if (msg.content === "music") { 37 | led.blink(); 38 | board.repl.inject({ 39 | piezo: piezo 40 | }); 41 | piezo.play({ 42 | song: "E D F D A - A A A A G G G G - - C D F D G - G G G G F F F F - -", 43 | beats: 1 / 4, 44 | tempo: 100 45 | }); 46 | } else if (msg.content == "music-close") { 47 | led.stop() 48 | } 49 | }); 50 | }) 51 | 52 | 53 | client.login('Token'); //Token Here 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "arduino-discord", 3 | "version": "1.0.0", 4 | "description": "Managing-Arduino-from-discord", 5 | "main": "main.js", 6 | "dependencies": { 7 | "ascii-table": "^0.0.9", 8 | "cli-table": "^0.3.1", 9 | "discord.js": "^12.4.0", 10 | "johnny-five": "^1.4.0", 11 | "serialport": "^9.0.0" 12 | }, 13 | "devDependencies": {}, 14 | "scripts": { 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/Furtsy/discord-arduino-bot.git" 20 | }, 21 | "keywords": [ 22 | "discord.js" 23 | ], 24 | "author": "Furtsy", 25 | "license": "ISC", 26 | "bugs": { 27 | "url": "https://github.com/Furtsy/discord-arduino-bot/issues" 28 | }, 29 | "homepage": "https://github.com/Furtsy/discord-arduino-bot#readme" 30 | } 31 | --------------------------------------------------------------------------------