# Intel Edison With Grove LCD, Temperature Sensor and Infrared Sensor

1,169

2

1

Grove LCD、Temperature sensor 與 Infrared sensor

mraa library中有完整的使用方式

Grove的官方資料與範例也相當齊全

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Grove LCD

import pyupm_i2clcd as lcd

myLcd = lcd.Jhd1313m1(0, 0x3E, 0x62)

myLcd.setCursor(1,0)
myLcd.write('Temperature ')

myLcd.write(str(temperature))

.....

## Step 2: Temperature Sensor

B = 3975

a_pin = mraa.Aio(0)

while True:

resistance = (1023.0 - pin_value)*10000.0/pin_value
temperature = 1.0/(math.log10(resistance/10000.0)/B+1/298.15)-273.15

## Step 3: Infrared Sensor

detect = mraa.Gpio(7)
detect.dir(mraa.DIR_IN)

while True:

if(people):

myLcd.setColor(255, 0, 0)

myLcd.setCursor(0,0)

myLcd.write('People coming....')

else:

myLcd.setColor(0, 255, 0)

myLcd.setCursor(0,0)

myLcd.write('Nobody here....')

## Step 4: Mix All Together

import mraa

import time

import pyupm_i2clcd as lcd

import math

B = 3975

detect = mraa.Gpio(7)

detect.dir(mraa.DIR_IN)

a_pin = mraa.Aio(0)

while True:

resistance = (1023.0 - pin_value)*10000.0/pin_value

temperature = 1.0/(math.log10(resistance/10000.0)/B+1/298.15)-273.15

myLcd.setCursor(1,0)

myLcd.write('Temperature ')

myLcd.write(str(temperature))

if(people):

myLcd.setColor(255, 0, 0)

myLcd.setCursor(0,0)

myLcd.write('People coming....')

else:

myLcd.setColor(0, 255, 0)

myLcd.setCursor(0,0)

myLcd.write('Nobody here....')

time.sleep(1)

## Recommendations

157 7.6K
15 1.1K
23 3.0K
Large Motors Class

13,712 Enrolled