Added arduino files

This commit is contained in:
plane000
2018-05-13 16:27:04 +01:00
parent f91a6a0e41
commit e9bf341391
7 changed files with 306 additions and 0 deletions

View File

@@ -7,7 +7,9 @@ using System.Threading.Tasks;
namespace Networking_Tools {
class UserInterface {
public void Load() {
}
}
}

BIN
C#/Terminology.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,89 @@
int MAXPINCLK = 10; // Define Digital Port 10
int MAXPINCS = 9; // Define Digital Port 9
int MAXPINDIN = 8; // Define Digital Port 8
unsigned char x; //occupies bytes on the memory
unsigned char y; //occupies bytes on the memory
unsigned char disp1[38][8]={
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C}, //Char 0
{0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10}, //Char 1
{0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E}, //Char 2
{0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0}, //Char 3
{0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8}, //Char 4
{0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0}, //Char 5
{0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0}, //Char 6
{0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8}, //Char 7
{0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E}, //Char 8
{0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E}, //Char 9
{0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22}, //Char A
{0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0}, //Char B
{0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0}, //Char C
{0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0}, //Char D
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C}, //Char E
{0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40}, //Char F
{0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C}, //Char G
{0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44}, //Char H
{0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C}, //Char I
{0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30}, //Char J
{0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24}, //Char K
{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C}, //Char L
{0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81}, //Char M
{0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0}, //Char N
{0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C}, //Char O
{0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20}, //Char P
{0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D}, //Char Q
{0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21}, //Char R
{0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C}, //Char S
{0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8}, //Char T
{0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C}, //Char U
{0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18}, //Char V
{0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0}, //Char W
{0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41}, //Char X
{0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8}, //Char Y
{0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F}, //Char Z
};
void MX7219_WRITE_byte(unsigned char DATA) {
unsigned char x;
digitalWrite(MAXPINCS,LOW);
for(x=8;x>=1;x--)
{
digitalWrite(MAXPINCLK,LOW);
digitalWrite(MAXPINDIN,DATA&0x80);// Extracting a bit data
DATA = DATA<<1;
digitalWrite(MAXPINCLK,HIGH);
}
}
void MX7219_WRITE(unsigned char address,unsigned char dat) {
digitalWrite(MAXPINCS,LOW);
MX7219_WRITE_byte(address); // The address code of the LED
MX7219_WRITE_byte(dat); //The data figure on LED
digitalWrite(MAXPINCS,HIGH);
}
void InitMAX7219(void) {
MX7219_WRITE(0x09, 0x00); //Set decoding BCD
MX7219_WRITE(0x0a, 0x03); //Set the brightness
MX7219_WRITE(0x0b, 0x07); //Set scan & limit 8 LEDs
MX7219_WRITE(0x0c, 0x01); //On power-down mode is 0normal mode is 1
MX7219_WRITE(0x0f, 0x00); //To test display 1 EOTdisplay 0
}
void setup() {
pinMode(MAXPINCLK,OUTPUT);
pinMode(MAXPINCS,OUTPUT);
pinMode(MAXPINDIN,OUTPUT);
delay(50);
InitMAX7219();
}
void loop() {
for(y=0;y<38;y++) {
for(x=1;x<9;x++)
MX7219_WRITE(x,disp1[y][x-1]);
delay(500);
}
}

View File

@@ -0,0 +1,34 @@
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
delay(100);
lcd.clear();
while (Serial.available() > 0) {
String input = String(Serial.read());
if (input.size() > 16) {
String subs;
for (int i = 16; i < input.size(); i++) {
String += input[i];
}
lcd.write(input);
lcd.setCursor(0, 1);
lcd.write(subs);
} else {
lcd.write(input);
}
}
}
}

View File

@@ -0,0 +1,31 @@
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2};
byte colPins[COLS] = {9, 8, 7, 6};
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key){
Serial.println(key);
}
}

View File

@@ -0,0 +1,19 @@
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
lcd.begin(16, 2);
lcd.print("Time since power");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
lcd.setCursor(10, 1);
lcd.print(counter);
counter++;
}

View File

@@ -0,0 +1,131 @@
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
const int cH = 523;
const int cSH = 554;
const int dH = 587;
const int dSH = 622;
const int eH = 659;
const int fH = 698;
const int fSH = 740;
const int gH = 784;
const int gSH = 830;
const int aH = 880;
const int buzzerPin = 8;
const int ledPin1 = 12;
const int ledPin2 = 13;
int counter = 0;
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
firstSection();
secondSection();
beep(f, 250);
beep(gS, 500);
beep(f, 350);
beep(a, 125);
beep(cH, 500);
beep(a, 375);
beep(cH, 125);
beep(eH, 650);
delay(500);
secondSection();
beep(f, 250);
beep(gS, 500);
beep(f, 375);
beep(cH, 125);
beep(a, 500);
beep(f, 375);
beep(cH, 125);
beep(a, 650);
delay(650);
}
void beep(int note, int duration) {
tone(buzzerPin, note, duration);
if(counter % 2 == 0) {
digitalWrite(ledPin1, HIGH);
delay(duration);
digitalWrite(ledPin1, LOW);
} else {
digitalWrite(ledPin2, HIGH);
delay(duration);
digitalWrite(ledPin2, LOW);
}
noTone(buzzerPin);
delay(50);
counter++;
}
void firstSection() {
beep(a, 500);
beep(a, 500);
beep(a, 500);
beep(f, 350);
beep(cH, 150);
beep(a, 500);
beep(f, 350);
beep(cH, 150);
beep(a, 650);
delay(500);
beep(eH, 500);
beep(eH, 500);
beep(eH, 500);
beep(fH, 350);
beep(cH, 150);
beep(gS, 500);
beep(f, 350);
beep(cH, 150);
beep(a, 650);
delay(500);
}
void secondSection() {
beep(aH, 500);
beep(a, 300);
beep(a, 150);
beep(aH, 500);
beep(gSH, 325);
beep(gH, 175);
beep(fSH, 125);
beep(fH, 125);
beep(fSH, 250);
delay(325);
beep(aS, 250);
beep(dSH, 500);
beep(dH, 325);
beep(cSH, 175);
beep(cH, 125);
beep(b, 125);
beep(cH, 250);
delay(350);
}