Menu

Tree [f6c38a] master /
 History

HTTPS access


File Date Author Commit
 firmware 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit
 img 2016-04-01 jochen@homeland jochen@homeland [f6c38a] adding concept files
 www 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit
 Makefile 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit
 Readme.md 2016-04-01 jochen@homeland jochen@homeland [5d6486] bugfix to the readme
 opendevice.c 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit
 opendevice.h 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit
 webLED.cpp 2016-03-31 jochen@homeland jochen@homeland [29998b] Initial commit

Read Me

webLED

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.

Concept

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.

Important Files

firmware/main.c

This is the vusb code for your ATmega/tiny etc. microcontroler. You have to modify it and the Makefile too.

firmware/usbdrv/usbconfig.h

This config file has all infos for libusb to ident the device. You need it for the firmware and for webLED.cpp (the driver).

www/index.php and status

These are example files for a webserver. The index.php writes status infos to the status file.

webLED.cpp

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.

Usage

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.

No more features?!

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!!

LICENSE

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

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.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.