Giter Site home page Giter Site logo

hid-serial's Introduction

========================================================

This folder contains Arduino code and host software to
demonstrate HID-class USB serial communication for AVRs
using V-USB. The code and circuit design are based on V-USB
http://www.obdev.at/products/vusb/index.html
and USnoobie. It is designed to work for ATmega328 but
can be adapted to other AVR microcontrollers as well.

The software is written by Ray Wang at Rayshobby LLC
and published under the Creative Commons Attribution-
ShareAlike (CC-SA) 3.0 license. 

========================================================

The folders are organized as follows:

- 'schematic' contains the circuit schematic and part list.
  Note that the circuit uses a 12MHz crystal (or resonator).
  This is the lowest frequency clock supported by V-USB.
  You need to set the mcu fuse bits accordingly to use external
  crystal oscillator. See the 'bootloader' folder below.

- 'bootloader' contains the modified USnoobie bootloader
  The bootloader is optional, but once flashed, it allows
  the mcu to bootload (by pressing the button during power-on
  or reset) as a usbasp programmer, so you will not need
  any external programer to flash a program.
  
  Check the 'burn.bat' file in the 'bootloader' folder for the
  recommended fuse bits.
  
- 'arduino code' contains the Arduino library for HIDSerial.
  To use it:
  * copy boards.txt (from hardware/arduino folder)
    to the corresponding folder in your arduino installation
    directory, and the HIDSerial library to your arduino's 
    libraries directory.
  * Run Arduino (the recommended version is 1.0.5 or 1.0.4).
  * Make sure you select 'USnoobie' from Tools -> Boards
  * If you use the USnoobie bootloader, select 'USBasp' from
    Tools -> Programmer. If not, select the name of the external
    ISP programmer you are using to flash the program.
  * Select any provided example from File -> Examples -> HIDSerial
  * Upload the example code to ATmega328.  

- 'host software' contains the standalone applications and Processing
   source code for HIDSerialMonitor. Please check the README.txt
   therein.

- Using the Arduino HIDSerial library:
  * The library provides several examples for you to learn how to
    get started using the API functions.
  * The HIDSerial class is similar to Arduino's Serial class. To
    use it, you need to first define a class variable, e.g.
    
    HIDSerial serial;
    
    Then, in your setup() function, call:
    
    serial.begin();
    
    Next, in your loop() function, you can use:
    
    serial.print(...);
    serial.println(...);
    serial.write(...);
    
    to print values to the host. You can also use:
    
    serial.available();
    
    to check if there is any incoming data, and
    
    serial.read(...);
    
    to read the incoming data to a char buffer. Again,these are similar
    to the Arduino's Serial class. The ***main difference***, though, 
    is that in the loop() you need to call
    
    serial.poll();
    
    as often as you can -- since the USB tasks are simulated in software,
    calling serial.poll() frequently ensures the mcu has ample time to 
    perform USB tasks. This requirement can be relieved in future updates,
    but for you please cope with the requirement.

========================================================

hid-serial's People

Watchers

 avatar

Forkers

juergs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.