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 zusammen,

anbei mein Code zur Erstellung einer CSV Datei, in der die Luftfeuchtigkeit jede 5 min abgespeichert werden soll. Lass ich den Code so laufen, wird bei mir im Ordner eine CSV Datei erstellt in der die Werte abgespeichert werden. Nun meine Frage:

 

Ist es möglich, dass ich diesen Code als Porgramm auf den Red Brick hoch lade und mir die CSV Dateien auf dem Red gespeichert werden? Und wenn ja wie? (Ich möchte nicht den Brick Logger nutzen)

 

Vielen Dank euch.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from time import *

HOST = "localhost"
PORT = 4223

UID_Hum = "Hu"

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_humidity import BrickletHumidity


if __name__ == "__main__":
    
    #Verbindung zu Bricklets wird aufgebaut.
    ipcon = IPConnection()
    
    Hum = BrickletHumidity(UID_Hum, ipcon)   
    ipcon.connect(HOST, PORT) # Connect to brickd
   
    # Don't use device before ipcon is connected
    
    t = time()
    flag = False
    j = True
    
    while True:
    
        Time_akt = localtime()
        
        if ((Time_akt[4] == 0 or Time_akt[4] == 5 or Time_akt[4] == 10 or Time_akt[4] == 15 or Time_akt[4] == 20 or Time_akt[4] == 25 or Time_akt[4] == 30 or Time_akt[4] == 35 or Time_akt[4] == 40 or Time_akt[4] == 45 or Time_akt[4] == 50 or Time_akt[4] == 55)\
             and flag == False):
    
            flag = True
            print('Flag: ' + str(flag))
            #Sensoren auslesen alle 5min
            
            Luftfeuchtigkeit =  Hum.get_humidity()
            
                        
            #Akutelle Systemzeit auslesen
            Jahr = str(Time_akt[0])
            Monat = str(Time_akt[1])
            Tag = str(Time_akt[2])
            Stunde = str(Time_akt[3])
            Minute = str(Time_akt[4])
    
            #Sensordaten konvertieren und speichern
           
            Hum_str = str(Luftfeuchtigkeit)
           
            
            
            Ausgabe =   (Jahr+'.'+Monat+'.'+Tag+';'\
                        +Stunde+':'+Minute+';'\                        
                        +Hum_str+';'\                                               
                        +'\n')    
    
            filename = (Jahr+'_'+Monat+'_'+Tag+'_schnell'+'_'+'Data.csv')    
    
            data = open(filename,'a')    
            data.write(Ausgabe)
            data.close()
        
               
        if ((Time_akt[4] >= 1 and Time_akt[4] < 5) or\
             (Time_akt[4] >= 6 and Time_akt[4] < 10) or\
             (Time_akt[4] >= 11 and Time_akt[4] < 15) or\
             (Time_akt[4] >= 16 and Time_akt[4] < 20) or\
             (Time_akt[4] >= 21 and Time_akt[4] < 25) or\
             (Time_akt[4] >= 26 and Time_akt[4] < 30) or\
             (Time_akt[4] >= 31 and Time_akt[4] < 35) or\
             (Time_akt[4] >= 36 and Time_akt[4] < 40) or\
             (Time_akt[4] >= 41 and Time_akt[4] < 45) or\
             (Time_akt[4] >= 46 and Time_akt[4] < 50) or\
             (Time_akt[4] >= 51 and Time_akt[4] < 55) or\
             (Time_akt[4] >= 56 and Time_akt[4] < 60)):
                 
            flag = False   
        
        t = time()        
        
        if j == False:
            break    
    
    ipcon.disconnect()

Geschrieben

Probier es doch einfach aus.

Normalerweise sollte es dort laufen und Deine csv-Datei im dortigen Homeverzeichnis anlegen.

  • 3 weeks later...
Geschrieben

Es geht devinitiv. Am besten du schreibst das File in deinen Programmordner.

Ich erstelle im Programmordner immer einen Unterordner (kann man vom Programmselber anlegenlassen) und schreibe da meine Files hinein.

Der RED benutzt die SD Karte als Festplatte , also Laufwerk. ;)

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.