dtoverlay=w1-gpio,gpiopin=14
# DS18B20_test28 tlfong01 2019may10hkt2137 ***
# Raspbian stretch 2019apr08, Python 3.5.3
# W1ThermSensor V0.3.0
# dtoverlay=w1-gpio,gpiopin=14
from w1thermsensor import W1ThermSensor
def findSensor():
for sensor in W1ThermSensor.get_available_sensors():
print(' Sensor ID =', sensor.id)
return
def getTemperature():
sensor = W1ThermSensor()
temperature_in_celsius = sensor.get_temperature()
print(' Temperature in Celsius =', temperature_in_celsius)
return
# *** Main Test ***
print('Begin Testing Ds18B20, ...')
findSensor()
getTemperature()
print('End Testing DS18B20, ...')
'''
Sample Output - tlfong01 2019may10hkt2150
>>>
RESTART: /home/pi/Python Programs/Python_Programs/test1198/ds18b20_test27_2019may1001.py
Begin Testing Ds18B20, ...
Sensor ID = 021312ca3baa
Temperature in Celsius = 25.562
End Testing DS18B20, ...
>>>
'''
# *** End of program ***
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){
return false;
}
return $first_img;
}
$posts = new WP_Query( $query_vars );
$GLOBALS['wp_query'] = $posts;
$("#owl-carousel").owlCarousel({
autoPlay: 4e3,
stopOnHover: !0,
singleItem: !0,
transitionStyle: "fade",
itemElement: ".item"
})
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'post',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'vivodit',
'value' => 'Da',
'compare' => 'LIKE',
)
),
));