Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

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, &current);

        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.

Geschrieben
  • Autor

Probier mal %d anstatt %f im printf

 

Danke hat geholfen...für solche Dinge hasse ich C

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.