Personal Computer

From MyRobots wiki
Jump to: navigation, search

PCs can be used to access the open API in many different ways, here we describe a few to give you some working examples of how you can use the power of MyRobots.com in your projects.

Contents

Python

Direct Connection

Using Python to access the API is very simple and does not require any additional library as illustrated in these examples

Serial Gateway

If you have devices such as an Arduino microcontroller that communicate serially with your computer and report sensor readings, you can synchronize the readings with MyRobots.com by using this script: SerialGateway.py

Windows

pcRobot PC monitoring program

PC Monitoring

You download pcRobot, a PC monitoring WPF Application written in C# for Windows. In order to use it, you need to run it as an administrator and enter the desired robot key. This program will monitor, the CPU, RAM usage and other metrics and post them to MyRobots.com

You can also use the source code to inspire yourself and create your own program.

Receiving an HTTP POST

Alerts can send a custom HTTP post and you can set the message sent iusing the Message field when defining them. Below are some examples on how to retrieve the POST content.

C# - ASP.NET Page

  Stream instream = Page.Request.InputStream;
  BinaryReader br = new BinaryReader(instream,
  System.Text.Encoding.UTF8);
  byte[] bytes = br.ReadBytes((int)instream.Length);
  string body = System.Text.Encoding.UTF8.GetString(bytes);     // This is the message sent by MyRobots.com

PHP

 <?php
   $body = file_get_contents("php://input");
 ?>
Personal tools
Namespaces
Variants
Actions