-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (44 loc) · 1.12 KB
/
Copy pathmain.cpp
File metadata and controls
56 lines (44 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* LED_strip.cpp
*
* Created: 02/11/2020 10:48:08
* Author : roman
*/
#include <stdio.h>
#include <stdlib.h>
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#define SPI_DDR DDRB
#define CS PINB2
#define MOSI PINB3
#define MISO PINB4
#define SCK PINB5
#include <string.h>
#include "LED_Apa102.h"
void SPI_init()
{
// set CS, MOSI and SCK to output
SPI_DDR |= (1 << CS) | (1 << MOSI) | (1 << SCK);
// enable SPI, set as master, and clock to fosc/128
SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
}
//class declarations into LED.h
//method declarations into LED.cpp
//in main include LED.h
//in LED.cpp include LED.h
//in LED.cpp include #include <avr/io.h>
int main(void)
{
LED led;
SPI_init();
while(1)
{
led.amount(40); //choose amount
//led.color(235, 29, 0,230); //pick color of leds
//led.blink(1000); // blink and pick time
led.snail(255, 0, 255,225); // snail motion . pick color
//led.mix(225,0,153,76,204,0,0); //choose 2 own colors to change
//led.random_colours(225); //random colours
}
}