To read the data from the device, you can either use the same Raspberry Pi 3 or another computer. I am going to use my MacBook as a client that is interested in the data sent by the device:
- Create a folder named test_client. Inside the test_client folder, run the following command:
$ npm init --yes
- Next, install the azure-event-hubs module (https://www.npmjs.com/package/azure-event-hubs) using the following command:
$ npm install azure-event-hubs --save
- Create a file named index.js inside the test_client folder and update it as detailed in the following code snippet:
var EventHubClient = require('azure-event-hubs').Client;var connectionString = 'HostName=Pi3-DHT11-Nodes.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=J0MTJVy+RFkSaaenfegGMJY3XWKIpZp2HO4eTwmUNoU='; ...