File | Date | Author | Commit |
---|---|---|---|
firmware | 2016-03-31 |
![]() |
[29998b] Initial commit |
img | 2016-04-01 |
![]() |
[f6c38a] adding concept files |
www | 2016-03-31 |
![]() |
[29998b] Initial commit |
Makefile | 2016-03-31 |
![]() |
[29998b] Initial commit |
Readme.md | 2016-04-01 |
![]() |
[5d6486] bugfix to the readme |
opendevice.c | 2016-03-31 |
![]() |
[29998b] Initial commit |
opendevice.h | 2016-03-31 |
![]() |
[29998b] Initial commit |
webLED.cpp | 2016-03-31 |
![]() |
[29998b] Initial commit |
The webLED is an example for v-usb and libusb to control a LED via a Webpage. The Makefile
in the firmware folder uses the USBasp to program the ATtiny85 / ATtiny45. You need a php running webserver with rights to write in a status file, to test it. Everything is designed/tested for Linux.
It is easy to make a USB-notify LED with vusb. But someone want to control this LED from a Webpage. You can make a QR-Code and scan it with your smartphone to visit the Webpage. My small php code writes a 0 in a status file, if you click the off button, and writes a 1 on clicking the on button.
This is the vusb code for your ATmega/tiny etc. microcontroler. You have to modify it and the Makefile too.
This config file has all infos for libusb to ident the device. You need it for the firmware and for webLED.cpp
(the driver).
These are example files for a webserver. The index.php
writes status infos to the status
file.
This code is the connction between your USB stick and the webserver. It reads a file from a webpage via polling (every 400ms) and sets the LED of your USB stick on/off.
If your USB-Stick is running well, you can use the "driver" (example):
./webLED example.com 8080 /testWebLed/status
You can stop the driver with CTRL + C. The driver running into a loop an checks all 400ms the content of http://example.com:8080/testWebLed/status
.
Feel free, to pimp the webpage (AJAX, Styles) and add more LEDs or blinking and fading features. But: I do not! I keep circuit and code in a very simple state. It is an example and not a foo fighting jabberwocky!!
Copyright (c) 2016 Jochen Peters (Krefeld) All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.