aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2020-02-09 11:30:30 -0600
committerRossTheRoss <msattr@gmail.com>2020-02-09 11:31:18 -0600
commit35d19270a62063f85b842d5df2981e8a88b21bd9 (patch)
tree4356d9048ae3550ff81a3b874c21aab991ec4409
parents p a c i n g (diff)
downloadee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar.gz
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar.bz2
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar.lz
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar.xz
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.tar.zst
ee2361-35d19270a62063f85b842d5df2981e8a88b21bd9.zip
redo?
-rw-r--r--Lab_2B.X/lab2b_c.c85
1 files changed, 44 insertions, 41 deletions
diff --git a/Lab_2B.X/lab2b_c.c b/Lab_2B.X/lab2b_c.c
index 21fdcba..7992b5b 100644
--- a/Lab_2B.X/lab2b_c.c
+++ b/Lab_2B.X/lab2b_c.c
@@ -36,73 +36,76 @@ int main(void) {
}
void writeColor(int r, int g, int b) {
+ int i = 0;
LATA = 0x0000;
wait_100us();
-
- for (int i = 0; i < 8; i++){
+ while (i < 8) {
if (r & 1) {
write_1();
} else {
write_0();
}
r >> 1;
+ ++i;
}
- for (int j = 0; j < 8; j++){
+ while (i > 0) {
if (g & 1) {
write_1();
} else {
write_0();
}
- g >> 1;
+ g >> 1;
+ --i;
}
- for (int k = 0; k < 8; k++){
+ while (i < 8){
if (b & 1) {
write_1();
} else {
write_0();
}
b >> 1;
+ ++i;
}
}
void loop(void) {
while (1) {
- LATA = 0x0000;
- wait_100us();
+// LATA = 0x0000;
+// wait_100us();
+//
+// //RED
+// write_1();
+// write_1();
+// write_1();
+// write_1();
+//
+// write_1();
+// write_1();
+// write_1();
+// write_1();
+//
+// //GREEN
+// write_1();
+// write_0();
+// write_0();
+// write_1();
+//
+// write_1();
+// write_0();
+// write_1();
+// write_1();
+//
+// //BLUE
+// write_0();
+// write_0();
+// write_0();
+// write_0();
+//
+// write_0();
+// write_0();
+// write_0();
+// write_0();
- //RED
- write_1();
- write_1();
- write_1();
- write_1();
-
- write_1();
- write_1();
- write_1();
- write_1();
-
- //GREEN
- write_1();
- write_0();
- write_0();
- write_1();
-
- write_1();
- write_0();
- write_1();
- write_1();
-
- //BLUE
- write_0();
- write_0();
- write_0();
- write_0();
-
- write_0();
- write_0();
- write_0();
- write_0();
-
- //writeColor(255, 155, 0);
+ writeColor(255, 155, 0);
}
} \ No newline at end of file