Einstein Posted June 16, 2012 at 07:47 PM Share Posted June 16, 2012 at 07:47 PM Hallo Leute, sieht jemand den Fehler in meinen Code? Ich versuche den SNR der Slave-Chibi auszulesen. Mit Java gehts unter C zeigt er mit 0.00000 #include <stdio.h> #include "ip_connection.h" #include "brick_master.h" #define HOST "XXX.XXX.XXX.XXX" #define PORT 4223 #define UID "XXXXXXXXXXX" // Change to your UID int main() { // Create IP connection to brickd IPConnection ipcon; if(ipcon_create(&ipcon, HOST, PORT) < 0) { fprintf(stderr, "Could not create connection\n"); exit(1); } // Create device object Master master; master_create(&master, UID); // Add device to IP connection if(ipcon_add_device(&ipcon, &master) < 0) { fprintf(stderr, "Could not connect to Brick\n"); exit(1); } // Don't use device before it is added to a connection uint16_t voltage; master_get_stack_voltage(&master, &voltage); uint16_t current; master_get_stack_current(&master, ¤t); printf("Stack Voltage: %f V\n", voltage/1000.0); printf("Stack Current: %f V\n", current/1000.0); // Get SNR uint8_t snr; master_get_chibi_signal_strength(&master, &snr); printf("%f", snr); } Vielleicht ist es einfach nur wieder "Betriebsblindheit" Edit: Ich verwende die aktuellen Bindings. Quote Link to comment Share on other sites More sharing options...
borg Posted June 16, 2012 at 10:57 PM Share Posted June 16, 2012 at 10:57 PM Probier mal %d anstatt %f im printf Quote Link to comment Share on other sites More sharing options...
Einstein Posted June 17, 2012 at 10:37 AM Author Share Posted June 17, 2012 at 10:37 AM Probier mal %d anstatt %f im printf Danke hat geholfen...für solche Dinge hasse ich C Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.