Successfully removed.
Sorry, an error occurred.
|
chatterBln added new videos to electronics
(3 weeks ago)
|
|
| |
|
chatterBln added a new video to Lights
(1 month ago)
|
|
| |
|
chatterBln added new videos to LEDs
(1 month ago)
|
|
| |
|
chatterBln uploaded a new video
(1 month ago)

Tiny & quick-written test routine to show the functionality of the build-in g-sensor.
Zero-tilt: blue & green LED is on. (in centered RGB-LE...
more
Tiny & quick-written test routine to show the functionality of the build-in g-sensor.
Zero-tilt: blue & green LED is on. (in centered RGB-LED) Tilting only left & right changes from center blue-green to left yellow LED (left tilt) or right yellow LED (right tilt). The centered green LED stays on to signalize, that there's no tilting back & forth. Tilting only back or forth changes from center blue-green to center blue-red. The blue LED stays on. Tilting in one of the for corners changes the center RGB-LED from blue-green to red and lights up one of the two yellow LED left or right from the center RGB-LED depending on the corner you are tilting in.
yellow(l)/red - blue/red - yellow(r)/red yellow(l)/green - blue/green - yellow(r)/green yellow(l)/red - blue/red - yellow(r)/red
Using the AVR Software Framework in the AVRstudio 5, all you'll need is:
int main(void) { // Initialize sensor_platform_init(); // Define sensor_t accel; sensor_data_t accel_data; sensor_attach(&accel,SENSOR_TYPE_ACCELEROMETER,0,0); accel_data.scaled = true; // acceleration in milli-G int32_t app_x_value, app_y_value, app_z_value; // 3 varia-bles int16_t inner = 150, outer = 140; // inner & outer boundary while(1) { sensor_get_acceleration(&accel,&accel_data); app_x_value = accel_data.axis.x; app_y_value = accel_data.axis.y; app_z_value = accel_data.axis.z; if (app_x_value [U+003C] -outer) LED_On(LED_RGB0_RED); if (app_x_value [U+003E] outer) LED_On(LED_RGB0_RED); if (app_x_value [U+003C] inner) LED_On(LED_RGB0_GREEN); if (app_x_value [U+003C] -inner) LED_Off(LED_RGB0_GREEN); if (app_y_value [U+003C] -outer) LED_On(LED0); if (app_y_value [U+003E] outer) LED_On(LED1); if (app_y_value [U+003C] inner) LED_On(LED_RGB0_BLUE); if (app_y_value [U+003C] -inner) LED_Off(LED_RGB0_BLUE); delay_ms(500); LED_Off(LED0_GPIO); LED_Off(LED1_GPIO); LED_Off(LED_RGB0_RED); LED_Off(LED_RGB0_GREEN); LED_Off(LED_RGB0_BLUE); } }
Since you can't use the less-than sign or the greater-than sign (looking like angle brackets) in youtube descriptions, I used instead the Unicode codes: U+003E = 'GREATER-THAN SIGN' U+003C = 'LESS-THAN SIGN'
less
|
|