Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ledproject
//g++ 5.4.0 #include <iostream> #define rx_buffer_size 256 #define data_buffer_size 256 using namespace std; unsigned char charToHexDigit(char c); // Variables volatile unsigned char data[data_buffer_size] = ""; volatile uint8_t rx_index = 0; volatile uint8_t read_complete = 0; int main() { uint16_t i = 0; uint16_t j = 0; volatile uint8_t temp1 = 0; volatile uint8_t ledIndex = 0; volatile uint8_t numLeds = 1; // Variables used for fading volatile uint8_t c_dif[3] = {0}; volatile uint8_t c_step[3] = {0}; volatile uint8_t c_val[3] = {0}; volatile uint8_t p_color[3] = {0}; volatile uint8_t new_color[3] = {0}; volatile uint16_t duration; data[0]='S'; data[1]='F'; data[2]='A'; data[3]='F'; data[4]='F'; data[5]='3'; data[6]='F'; data[7]='X'; int red = 0, green = 0, blue = 0; i = 1; while(data[i] != 'X' && data[i] != 'x'){ red = (charToHexDigit(data[i++]) << 4) | (charToHexDigit(data[i++])); cout<< red <<endl; green = (charToHexDigit(data[i++]) << 4) | (charToHexDigit(data[i++])); cout<< green <<endl; blue = (charToHexDigit(data[i++]) << 4) | (charToHexDigit(data[i++])); cout<< blue <<endl; } int k = (charToHexDigit('0')<<4)|(charToHexDigit('8')); cout<< k <<endl; } unsigned char charToHexDigit(char c){ if(c >= 'a'){ return c - 'a' + 10; } else if(c >= 'A'){ return c - 'A' + 10; } else{ return c - '0'; } }
run
|
edit
|
history
|
help
0
EqualIdentical
pointer to template function
code
team name
Certificate Printing
error
Riemann's prime number formula
Depth of Bin tree
Stream11
BadCastAllExcept