Difference between revisions of "Arduino Night"

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

Latest revision as of 13: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)