blob: 88be84c33ceaf6192ca7db847241c1a297849c6a (
plain)
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
|
#include <stdlib.h>
#include <stdio.h>
#include "display.h"
#include "sensor.h"
void give_error( const char* msg )
{
char* buffer = runtime_error_nice_print( msg );
runtime_error( buffer );
free(buffer);
}
int update_main( void )
{
if ( !sensor_init() )
runtime_error("sensor init failed");
if ( !display_init() )
runtime_error("display init failed");
char buffer[32];
float reading = sensor_read();
snprintf( buffer, 32, "Sensor: %0.1f", reading );
display_update( buffer );
return 0;
}
|