Difference between revisions of "Arduino Night"

From Unallocated Space
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Random Code==
+
== External code links ==
* Writing an arbitrary number of bits to pins
+
Various code snippets used during class - http://pastebin.com/u/uas_arduino
  byte pins[] = {2,3,4,5,6,7};
 
  byte totalPins = 6;
 
 
 
  void setup(){
 
      for(byte a = 0; a < totalPins; a++){
 
        pinMode(pins[a], OUTPUT);
 
      }
 
  }
 
 
 
  void writeData(byte data, byte numberOfBits, byte startBit){
 
      for(byte a = startBit; a < numberOfBits; a++){
 
        if((data >> a) & 0x01){
 
            digitalWrite(pins[a], HIGH);
 
        }else{
 
            digitalWrite(pins[a], LOW);
 
        }
 
      }
 
  }
 
  
 +
==Classes==
  
==Scooter Code==
+
1) Here we go again <span style="color:red">-done</span>
* The following code is for controlling the scooter wirelessly.
 
 
  struct data {
 
      byte start;
 
      byte left;
 
      byte right;
 
      byte finish;
 
  };
 
  
  typedef struct data Packet;
+
2) Digital Write
  
  Packet myData =  {0, 0x55, 0x7e, 0};
+
3) Digital Read
 +
 
 +
4) Analog Write
 +
 
 +
5) Analog Read
 +
 
 +
6) Serial
 +
 
 +
7) Interrupts
 +
 
 +
8) ShiftOut In
 +
 
 +
9) I2C
 +
 
 +
10) SPI
 +
 
 +
11)
 +
 
 +
12)
 +
 
 +
13)

Latest revision as of 14:57, 18 June 2016

External code links

Various code snippets used during class - http://pastebin.com/u/uas_arduino

Classes

1) Here we go again -done

2) Digital Write

3) Digital Read

4) Analog Write

5) Analog Read

6) Serial

7) Interrupts

8) ShiftOut In

9) I2C

10) SPI

11)

12)

13)