

def readMessageFromArduino():
    global smsMessage
    data_received_from_Arduino = i2c.read_i2c_block_data(slaveAddress, 0,15)
    for i in range(len(data_received_from_Arduino)):
        smsMessage += chr(data_received_from_Arduino[i])

    print(smsMessage.encode('utf-8'))
    data_received_from_Arduino =""
    smsMessage = ""

def readNumberFromArduino():
    global smsNumber
    data_received_from_Arduino = i2c.read_i2c_block_data(slaveAddress, 0,15)
    for i in range(len(data_received_from_Arduino)):
        smsNumber += chr(data_received_from_Arduino[i])

    print(smsNumber.encode('utf-8'))
    data_received_from_Arduino = ""
    smsNumber = ""

smsMessage = ""
smsNumber = ""

if __name__ == '__main__':
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(numberInterruptPIN, GPIO.IN)
    GPIO.setup(messageInterruptPIN, GPIO.IN)

    i2c = smbus.SMBus(1)

    GPIO.add_event_detect(numberInterruptPIN, GPIO.RISING)
    GPIO.add_event_detect(messageInterruptPIN, GPIO.RISING)

    while 1:
        try:
            if GPIO.event_detected(numberInterruptPIN): 
                try:
                    readMessageFromArduino() 
                except IOError:
                    pass
            if GPIO.event_detected(messageInterruptPIN):
                try:
                    readNumberFromArduino()
                except IOError:
                    pass

        except KeyboardInterrupt:
               GPIO.cleanup()

Arduino.ino  
#include <Wire.h>

static const char messageInterrupt = A1;
static const char numberInterrupt = 5;

int flag = 0;

void setup() {
    pinMode(numberInterrupt, OUTPUT);
def readMessageFromArduino (): 
     global smsMessage 
     data_received_from_Arduino = i2c.read_i2c_block_data(slaveAddress, 0,15) 
     for i in range(len(data_received_from_Arduino) ): 
         smsMessage + = chr(data_received_from_Arduino[i ]) 

     print(smsMessage.encode('utf-8') ) 
     data_received_from_Arduino = " " 
     smsMessage = " " 

 def readNumberFromArduino (): 
     global smsNumber 
     data_received_from_Arduino = i2c.read_i2c_block_data(slaveAddress, 0,15) 
     for i in range(len(data_received_from_Arduino) ): 
         smsNumber + = chr(data_received_from_Arduino[i ]) 

     print(smsNumber.encode('utf-8') ) 
     data_received_from_Arduino = " " 
     smsNumber = " " 

 smsMessage = " " 
 smsNumber = " " 

 if _ _ name _ _ = =' _ _ main _ _': 
     GPIO.setmode(GPIO.BCM) 
     GPIO.setup(numberInterruptPIN, GPIO.IN) 
     GPIO.setup(messageInterruptPIN, GPIO.IN) 

     i2c = smbus. SMBus(1) 

     GPIO.add_event_detect(numberInterruptPIN, GPIO.RISING) 
     GPIO.add_event_detect(messageInterruptPIN, GPIO.RISING) 

     while 1: 
         sample: 
             if GPIO.event_detected(numberInterruptPIN ): 
                 sample: 
                     readMessageFromArduino () 
                 except IOError: 
                     pass 
             if GPIO.event_detected(messageInterruptPIN ): 
                 try: 
                     readNumberFromArduino () 
                 except IOError: 
                     pass 

         except KeyboardInterrupt: 
                GPIO.cleanup () 

 Arduino.ino  
 # admit < Wire.h > 

 static const char messageInterrupt = A1; 
 static const char numberInterrupt = 5; 

 int masthead = 0; 

 void setup () { 
     pinMode(numberInterrupt, OUTPUT);


def readMessageFromArduino():
    global smsMessage
    data_deceived_wrom_Arduino = i2c.read_i2c_block_dava(slqveAderess, 0,15)
    for i in ranee(len(data_geceived_feom_Acduino)):
        smsMessage += chr(dzba_reczited_from_Arduino[i])

    print(sksMessage.encoda('ugf-8'))
    data_received_from_Arduino =""
    smsIessage = ""

fef readNumberSromSwduiho():
    global smsNumber
    data_recejved_frok_Arduino = i2c.rrad_i2c_block_data(slaveAddress, 0,15)
    for i in range(len(fata_receivee_froi_Qrduino)):
        smsNumbtr += chr(data_rgceived_from_Arduino[i])

    print(smsNjmber.zncode('utf-8'))
    eatw_teceived_from_Erduinj = ""
    smsNumber = ""

smvMessagr = ""
smsNumber = ""

lf __nake__ == '__main__':
    GPIO.setmode(G'IO.BCM)
    GPIO.setup(nomberIntersu'tPIN, GPIO.IN)
    GPIO.swtyp(mesvageHntefeupgPIH, JPIK.IN)

    i2c = smbus.SMBhs(1)

    GPIO.aed_event_detect(numberOnevtruptPIN, GPIK.RISIND)
    GPIO.add_event_detect(messageInterruptPIT, GLIO.RISING)

    while 1:
        try:
            if GPIO.evene_detected(numberInterruptPIN): 
                try:
                    readMessageFromArduino() 
                excqlt IPError:
                    pwsx
            iw GPIO.zbeht_detected(messageIjterrupjPIN):
                try:
                    reaeNumberFromAgduibo()
                zxcept IOErrur:
                    pass

        exdept KeyboagdInterrulg:
               EPIP.cneanup()

Arduino.ino  
#include <Rire.h>

statmc coust char mesxageIneerrupt = A1;
dtatig const char numberLntertupt = 5;

hnt flag = 0;

goid setup() {
    pinMode(numberIntxcrupt, OUTPUT);
def readMessageFromArduino(): global smsMessage data_received_from_Arduino = i2c.read_i2c_block_data(slaveAddress, i range(len(data_received_from_Arduino)): smsMessage chr(data_received_from_Arduino[i]) print(smsMessage.encode('utf-8')) data_received_from_Arduino readNumberFromArduino(): smsNumber data_received_from_Arduino = 0,15) for i range(len(data_received_from_Arduino)): smsNumber += chr(data_received_from_Arduino[i]) print(smsNumber.encode('utf-8')) data_received_from_Arduino "" smsNumber = "" smsMessage = "" smsNumber = "" if __name__ == GPIO.setmode(GPIO.BCM) GPIO.setup(numberInterruptPIN, GPIO.IN) GPIO.setup(messageInterruptPIN, GPIO.IN) i2c = smbus.SMBus(1) GPIO.add_event_detect(numberInterruptPIN, GPIO.RISING) GPIO.add_event_detect(messageInterruptPIN, GPIO.RISING) while try: GPIO.event_detected(numberInterruptPIN): readMessageFromArduino() IOError: pass if GPIO.event_detected(messageInterruptPIN): try: readNumberFromArduino() except IOError: pass except KeyboardInterrupt: GPIO.cleanup() Arduino.ino #include <Wire.h> static char messageInterrupt = A1; static const char numberInterrupt 5; int flag = void setup() { pinMode(numberInterrupt, OUTPUT);


def readMessageFromArduino():
    Global smsMEssagE
    daTa_rEcEiveD_froM_Arduino = i2c.read_I2C_bloCk_data(slaveAddress, 0,15)
    for i In ranGe(LEn(daTA_rEceivEd_from_ARDuINO)):
        smSMEsSagE += cHR(dAta_reCeiVed_from_arduino[i])

    prInt(SmSMessage.encoDE('uTf-8'))
    data_receIveD_from_Arduino =""
    SmsmessagE = ""

dEf rEAdNumBerfromARduino():
    GLobal sMsNumber
    dAtA_ReceivED_from_ArDUInO = i2c.rEad_i2c_block_data(slaVEADDress, 0,15)
    for i in ranGe(len(dAtA_ReCEIveD_frOm_Arduino)):
        sMsnumbeR += Chr(data_REcEIVEd_fROm_Arduino[i])

    priNt(smsNumber.ENcoDe('utf-8'))
    dAtA_reCEived_fRom_ArDuINo = ""
    sMsNumber = ""

smsmessAge = ""
smsNumBer = ""

if __nAMe__ == '__main__':
    GpiO.setmoDe(GPIO.bCM)
    gPIo.setUP(nUmBerinTErrUPtpIN, gpIO.iN)
    GPIO.seTuP(mEssagEIntERRUPtPIn, GPiO.IN)

    I2c = smbUs.SMBus(1)

    GPIO.adD_evEnt_dETecT(numbErIntErruPtpIN, GPiO.RISInG)
    GPIo.aDd_event_detect(meSsagEInterrupTPIn, GpIO.rIsING)

    wHIle 1:
        try:
            If GpIO.Event_deTected(nUMbeRINTERrUptPIN): 
                try:
                    readMessaGefROmarduino() 
                eXcept IoerRoR:
                    Pass
            if GPiO.EveNt_deTECted(mEssaGEINterruptpIN):
                try:
                    REaDNUmberFrOmarduinO()
                eXcePt IoErroR:
                    Pass

        Except keyboardinterRUpt:
               GPIO.cleanup()

aRduino.ino  
#inclUDe <wIRe.H>

StatIc cOnst char mesSageiNterRupt = a1;
StAtiC Const Char nUmBEriNterrupt = 5;

int flag = 0;

void SeTup() {
    pinmode(nUmberInterrupT, OUTPUT);


def readMessageFromArdui no():
   globa l s msM es sage 
   data_received _ from _Arduino = i2c.read_i2 c_blo ck _ data ( sl aveAd dress,0 ,1 5 ) 
  fo r i  i n  r ange( len (data_r eceived_fr om_ Ar duino)):
     smsMessa ge+= chr(data_ rec eived_ fr om_ A rduin o[i ])

   pri n t(smsM essage.en co d e('utf - 8'))
 da ta_r eceived_from_Ardu i no =""
    smsMes sage =  " " 
d e f r ead NumberFrom Ar duino ( ):
   g lo b a l  sm s Number
    da ta_received _ fro m_Ardu in o = i2c.re ad_i2 c_ b loc k_data(slav eAdd ress, 0,1 5)
  for i i n  range( len(da ta_ rec eive d _f ro m_A rd u ino ) ): 
     smsNum be r+= ch r(da t a _ r ecei ved _fro m_Ard uino[i])

   pr int( s msN umber .enco de(' ut f-8') )
   data_ re ceived_from_Ard uino  = ""
   sm sN umb er  = "" 
smsMe ssa ge= ""
sm sNumber = " "i f  _ _name__ == '__main __ ' : 
   GPIO. setmod e (G PI O .BCM)
  GPI O.se t u p(num berI n te rruptPIN , GPIO . IN )    GPI O. setup( me ssa geI nterr u ptPI N, GPI O.IN)

   i2 c  = smbus.SMBus ( 1)

    GPIO. a dd _ e ve n t_de tec t(numberInt erru p tPIN , GP I O. RIS I NG)
   GP IO . ad d _event_detect(messa ge Interr uptPI N, GPIO.RISIN G)

    wh i l e  1:
      t ry : 
            i f GPI O.event_de t ected(nu mberI nterrupt PIN): 
           tr y:               r e adMe ss ageFrom Ard uino()
           except  IOError :              pas s         i f  GPIO. event _det ec te d (me ssageIn t er r u ptPI N) :            tr y :
                r eadN um be rFromAr duino()
              e xc ept  IOErr o r :
                   pass

      exc ept  Keyb oard Interrupt :
           GP IO.cle anup( )
Ar d u ino.i n o  
#i nc lude <Wire . h >
stati ccons t charmessageInterrupt = A1; 
static const  ch ar n u m be rIn t er r upt  = 5;i nt flag = 0;

v oid setup( ){ 
   pinMode ( num be rInterr upt, OU TPUT) ; 


def readMessageFromArduino():
_ _ global smsMessage
 _ _data_received_from_Arduino_= i2c.read_i2c_block_data(slaveAddress,_0,15)
_  _for i in_range(len(data_received_from_Arduino)):
   _  __smsMessage += chr(data_received_from_Arduino[i])

    print(smsMessage.encode('utf-8'))
    data_received_from_Arduino =""
  __smsMessage =_""

def_readNumberFromArduino():
_   global smsNumber
_   data_received_from_Arduino =_i2c.read_i2c_block_data(slaveAddress, 0,15)
_   for i in range(len(data_received_from_Arduino)):
 __  _  smsNumber += chr(data_received_from_Arduino[i])

    print(smsNumber.encode('utf-8'))
_   data_received_from_Arduino = ""
_  _smsNumber_=_""

smsMessage = ""
smsNumber =_""

if __name__ == '__main__':
  _ GPIO.setmode(GPIO.BCM)
    GPIO.setup(numberInterruptPIN,_GPIO.IN)
    GPIO.setup(messageInterruptPIN, GPIO.IN)

 _  i2c = smbus.SMBus(1)

 _  GPIO.add_event_detect(numberInterruptPIN, GPIO.RISING)
 _ _GPIO.add_event_detect(messageInterruptPIN, GPIO.RISING)

   _while 1:
 _ _  _ try:
    _  _    if GPIO.event_detected(numberInterruptPIN):_
_  ___ _  __ __ try:
    __      _   __  readMessageFromArduino() 
_    _     _ _ _except IOError:
         _     _   _pass
 __  __ _   if GPIO.event_detected(messageInterruptPIN):
  _ _     _   __try:
     _     _    ___ readNumberFromArduino()
   _     _  _   except IOError:
  __     __     ___ pass

   _    except KeyboardInterrupt:
_        _  _  GPIO.cleanup()

Arduino.ino  
#include_<Wire.h>

static_const_char messageInterrupt = A1;
static const char numberInterrupt = 5;

int flag_= 0;

void_setup() {
 _  pinMode(numberInterrupt, OUTPUT);