Poll Nano with BLE for Motion Sensor State

Hello y'all!

I admit I am relatively new to the world of Arduino so my questions may sound "unprofessional" - my apologies for that already!

1st off: I have an Arduino Nano V3 connected to a Bluetooth LE module and a PIR motion sensor. What I need to do is to set it up so e.g. a RPi can check the status of the PIR output (high or low). I figures the PIR part out already - so it connects to PIN12 and I can check that pin and set the LED accordingly - it works!

What I don't get is the BLE communication part - the idea is that the Nano listens via BLE and once it receives a "request" replies either with "1" oder "0" depending on the PIN12 state.

Is there some generic code example I can use for that - preferably with a bash or python counterpart to use on the RPi?

Any help would be highly appreciated! Thank you in advance!

What I don't get is the BLE communication part

The BLE is a radio. It gets data over the air, and writes to a pin. Data written to another pin is broadcast.

So, the first question is which pins it is connected to.

The HardwareSerial or SoftwareSerial classes are used to read from/write to the device, depending on which pins the device is connected to.

Oh I hope I am using the right terms - have the "Bluetooth 4.0 HM-10 Master Slave Module" connected to the RX and TX pins of the Nano.

beejayf: Oh I hope I am using the right terms - have the "Bluetooth 4.0 HM-10 Master Slave Module" connected to the RX and TX pins of the Nano.

So, reading what to do involves the use of Serial.available() to see if there is data to read and Serial.read() to read the data.

Reporting results involves the use of Serial.print(), Serial.println(), and/or Serial.write().