Monday, January 30, 2017

Raspberry Pi - Display Resolution change

Check the supported modes using command tvservice

pi@raspberrypi:~ $ tvservice -m DMT
Group DMT has 1 modes:
           mode 4: 640x480 @ 60Hz 4:3, clock:25MHz progressive
pi@raspberrypi:~ $ tvservice -m CEA
Group CEA has 2 modes:
           mode 4: 1280x720 @ 60Hz 16:9, clock:74MHz progressive
  (prefer) mode 16: 1920x1080 @ 60Hz 16:9, clock:148MHz progressive

DMT - Monitor mode support only Mode 4

CEA - TV Mode support 4 and 16

Update same in the /boot/config.txt file

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=1 ### HDMI_GROUP = 1 means Group CEA for Grop DMT, the value is 2
hdmi_mode=16  




Tweet from Raspberry Pi - Raspbian OS


Install and configure components

sudo apt-get install python-pip
sudo pip install twython
sudo pip install requests requests_oauthlib

Python Code:

from twython import Twython

APP_KEY=' '
APP_SECRET=''
OAUTH_TOKEN=''
OAUTH_TOKEN_SECRET=''

twitter = Twython(APP_KEY,APP_SECRET,OAUTH_TOKEN,OAUTH_TOKEN_SECRET)

strTweet = 'Hi..!!'
twitter.update_status(status=strTweet)

Raspberry Pi - GPIO (Button Down Input, LED Output)

This code will take button press down input from GPIO pin 11 and LED output to pin 15.

BreadBoard Setup
PIN Mapping
Pi 11 = Wedge GP17
Pi 15 = Wedge GP22

Python Code:
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)

GPIO.setup(15,GPIO.OUT)
GPIO.output(15,0)

try:
    while True:
        if(GPIO.input(11) == 1):
            GPIO.output(15,1)
        else:
            GPIO.output(15,0)

except KeyboardInterrupt:
    GPIO.cleanup()