Jump to content

Barometer springt


Recommended Posts

Posted

Hallo,

 

Habe Probleme mit dem Barometer. Ich lese zyklisch den Luftdruck ab und der Wert springt auf einmal um 10mbar nach unten bleibt dann da kurz und geht dann wieder auf den höheren Wert.

Ich habe "Step-Down Power Supply"(12 V) einen Master ( FW 1.3.4 ) und WIFI.

Als Bricklet das Barometer (FW 1.1.0) und LCD 20x4 ( FW 1.1.0 ).

 

Das Programm

# -*- coding: utf-8 -*-


use feature ":5.10";
use strict;
use brick;

STDOUT->autoflush(1);
STDERR->autoflush(1);

# meine Bricks
my $bricks_uid = {
master			=> [ qw/94ANbg9wr7Q/ ],
dc				=> [ qw/9Jk6hqGy1M1/ ],
stepper			=> [ qw/9ekEFBE4X9N 94CZEf7VcxY/ ],
servo			=> [ qw/94ANb31uMYf/ ],
joystick		=> [ qw/9JA/ ],
distance_ir		=> [ qw/9sN/ ],
rotary_poti		=> [ qw/8zQ/ ],
barometer		=> [ qw/bAm/ ],
lcd_20x4		=> [ qw/bfs/ ],
current25		=> [ qw/9AS/ ],
dual_relay		=> [ qw/9T3/ ],
ambient_light	=> [ qw/8So/ ],
analog_in		=> [ qw/9CU/ ],
analog_out		=> [ qw/a2j/ ],
io4				=> [ qw/8Qj/ ],
};

# Initialisierung

my $brickd = brickd->new('192.168.11.105' => 4223 );
my $master = $brickd->new('master',$bricks_uid->{master}->[0],);
my $lcd;
$lcd = $brickd->new('lcd_20x4',$bricks_uid->{lcd_20x4}->[0],{
clear_display => [],
backlight_on => [],
CALLBACK_BUTTON_PRESSED => 
	sub {
		my $butt = shift @_;
		if( $butt == 0 ) {
			$lcd->backlight_off;
			sleep(1) if $^O =~ /Win/i;
			die "not aus@_\n";
		} elsif ( $butt == 1 ) {
			if( $lcd->is_backlight_on ) {
				$lcd->backlight_off;
			} else {
				$lcd->backlight_on;
			}
		}
	},
});
my $baro;
$baro = $brickd->new('barometer',$bricks_uid->{barometer}->[0],{
set_air_pressure_callback_period => 1000, 
CALLBACK_AIR_PRESSURE => 
sub { 
	my $press = shift @_;
	$lcd->write_line(1,0,sprintf("%4.3f mbar",$press / 1000));
	$lcd->write_line(2,0,sprintf("%2.2f C",$baro->get_chip_temperature/100));
},
});

# IP- Test
my @a = $master->get_wifi_status;
my @ip = reverse @{ $a[4]};
$lcd->write_line(0,0,sprintf("IP = %3d.%3d.%3d.%3d",@ip));

# und los
$baro->wait(-1,$lcd);

 

ist taste das Barometer mit 1000 ms ab.

 

Haben das Problem auch noch andere ?

Was ist zu tun ?

Und noch was für TF das ° Zeichen für °C geht auf dem LCD nicht.

 

Armin

Posted

Ich kann das beschriebene Problem reproduzieren. Es hängt mit dem Schreiben aufs LCD zusammen. Dei genau Ursache ist noch nicht klar. Ich untersuche das grade noch.

 

Zum ° Zeichen: Das LCD hat einen speziellen Zeichensatz, der auch in der Dokumentation der write_line Funktion verlinkt ist:

 

https://github.com/Tinkerforge/lcd-20x4-bricklet/raw/master/datasheets/standard_charset.pdf

 

Der Zeichensatz beinhaltet ein Katakana Zeichen, das man als ° Zeichen verwenden kann.

 

Wie zwischen Unicode un dem speziellen LCD Zeichensatz abgebildet werden kann kannst du dem Unicode Beispiel entnehmen:

 

http://www.tinkerforge.com/doc/Software/Bricklets/LCD20x4_Bricklet_C.html#unicode

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...