Search Forums by tag:
Serial, mbed, compiler, ethernet, USB, I2C, SPI, interrupt, LCD, library, bug, HTTPServer, CAN, AnalogIn, adc, Power, Ticker, memory, pwm, SD Card, InterruptIn, rpc, Error, SDFileSystem, PwmOut, LocalFileSystem, UART, canbus, driver, TCP, interrupts, rtos, led, libraries, editor, timer, accelerometer, GPS, file, clock, website, C++, SD, frequency, reset, http, LPC11U24, flash, SDCard, RTC, DigitalIn, TCPSocket, problem, printf, Java, Servo, buffer, UDP, SerialPC, DMA, HTTPClient, Sleep, audio, pinball, MODSERIAL, NetServices, socket, array, compile, filesystem, RFID, beta, m3pi, write, LPC1768, multiple, newbie, keyboard, sensor, GPRS, Forum, digitalOut, assembly, debug, hardware, Speed, xbee, AnalogOut, RPCFunction, EthernetNetIf, Download, code, voltage, wait, network, C, suggestion, JTAG, keil, MATLAB, offline, Board, lwip, I2S, dead, Nokia6610, time, bluetooth, WiFly, current, tcp/ip, MODDMA, SPI Slave, pololu, robot, Communication, read, dac, string, pc, binary, filter, copy, USB Host, publish, rs232, DHCP, Host, Data Logging, windows, firmware, malloc, mp3, PCB, gcc, attach, program, fatfilesystem, class, email, arduino, stepper motor, WavePlayer, wifi, Nokia, camera, size, VGA, import, documentation, ide, linux, baud, TextLCD, Cortex-M0, M0, pointers, pullup, Relay, timing, function, latency, serial port, MIDI, compiler error codes, magjack, touch, screen, Production, client, server, stream, HID, breakout, FIFO, prototype, flashing, GPIO, sampling, Analog, display, api, ADXL345, Encoder, DSP, help, motor, sram, suggestions, PING, Terminal, link, browser, Pin, control, Eagle, Modbus, EEPROM, mac, Timeout, fopen, port, updates, usbserial, batteries, DMX, files, USBMIDI, scanf, protocol, PPP, slave, FTP, integer, noise, MODGPS, modem, float, threads, motors, for, monitor, Digital I/O, 7, Windows Serial Driver, pins, keypad, FAT, classes, webserver, delay, variables, time-triggered, c programming, labview, watchdog, post, math, Battery, LPCXpresso, MBED website, GSM, storage, nxp, mobileLCD, license, int, counter, baseboard, Assembler, Vin, rj45, registers, E289, news, i2cmaster, amoled, Compiling, connect, revision, prototype to hardware, UMTSStick, Optocoupler, Robotics, search, oscillator, glitch, Websockets, load, find, real-time, routine, format, offline compile, powersource, driverlibrary, processing, networking, ID, umts, debugging, color, BUTTON, software, PS3, Images, wave, bin, const, SNMP, OSX, supply, peripheral, sensors, data, Design, PID, version, RIT, character, freeze, USBDevice, bus, ARM, wav, SRF08, heap, output, basic, TFT, QVGA, mysql, piezo, update, ID12, Pachube, player, DigitalInOut, object, cmsis, capture, IR, slow, 1768, PSP, OS, syntax, mbed.lib, EmbeddedArtists, NMEA, paste, project, Web, GUI, UART0, firefox, SQL, wakeup, RAM, bitmap, handler, security, 3D, bugs, OLED, Temperature, not, I/O, Bidirectional, rss, wireless, delete, resolved, LED1, LIS302, getc, Safari, Wi-Fi, wiki, PinNames, accounts, PS2, BusOut, projects, RS485, pythonI found the information myself. http://mbed.org/cookbook/RPC-Interface-Library Next time I will read or search better, before posting
Hi Jasper
The information you've found is a good way of making custom funtionality over RPC. However, looking at what you want to achieve, an output pin toggling continuously (if I've understood what you're trying to acheive correctly) then you might find it easiest to use PwmOut which works with RPC in the same way as the DigitalOuts/LEDs do. You can set the period and pulsewidth using RPC without needing to define a custom function. This might give you the type of output you are looking for quickly.
eg: http://<your_ip_address>/rpc/led4/period_us 300
http://<your_ip_address>/rpc/led4/pulsewidth_us 100
Where you've defined led4 as an PwmOut rather then a DigitalOut. You can use PWM out on pins 21-26 and the LEDs
Michael
Hi Michael.
I want to open the garage door with a 433Mhz RF transmitter (like this http://www.sparkfun.com/products/8946). I will connect one digital pin from the mbed to the transmitter. All I need to do is toggle that pin according to a certain pattern. In this case that's not so repetitive that I can use a PWM output. The example in the RPC Interface library is exactly what I need. I will call a RPCfunction that toggles the output pin.
http://<your_ip_address>/rpc/garagedoor/open
Jasper
Ok I have the HTTP server and RPC handler working and I can turn on a LED. I have imported the RPCInterface libary into the program. However I cannot get RPCFunction example code to run
//Create a function of the required format
void foo(char * input, char * output);
//Attach it to an RPC object
RPCFunction rpc_foo(&foo, "foo");
void foo(char * input, char * output){
int x,y;
sscanf(input, "%i, %i", &x, &y);
//Do something here......
sprintf(ouput, "%i, %i", x, y );
}
The compiler complaints: Identifier "RPCFunction" is undefined (E20) in the line containing "RPCFunction rpc_foo(&foo, "foo");"
The compiler also complaints about: "Expected a ")" (E18) in the same line
The compiler complaints about: "Identifier "ouput" is undefined (E20)
I can imagine it complaints about "ouput" without the t. However when I add #include "RPCInterface.h" to the code the first two errors disapear and the new error is:
"Cannot open source input file "RPCInterface.h": No such file or directory (E5)
Can you create a working RPCfunction example that flashes a LED three times and post it to the cookbook? And also the RPC command?
Hi
Library to provide a mechanism to make it easier to add RPC to custom code by using RPCFunction and RPCVariable objects. Also includes a class to receive and process RPC over serial.
Library published 28 Jan 2012 by
Michael Walker
If you look through the library then you see there is no file "RPCInterface.h" in the library hence you get that error. To use RPCFunctions, you need to include "RPCFunction.h" or to use RPCVariables "RPCVariable.h"
The header files correspond to each classes name not the library name, thats just the name they are grouped and published under.
Michael
Hi Michael, Thanks. I found out that its is important to correctly write uppercase and lower case.
Jasper
Finally my code is working
when I call http://<your_ip>/rpc/foo/run
this function is called
void foo(char * input, char * output){
int x,y;
sscanf(input, "%i, %i", &x, &y);
//Do something here......
led2 = 1;
led3=1;
led4=1;
sprintf(output, "%i, %i", x, y );
}
and the LEDs go on!
Thanks Michael!
Jasper
Hi Michael, I just want to inform that I have my project functionally working. Now I can call a function through RPC over http. The function toggles a pin that is connected to a 433Mhz wireless data transmitter. I can now open the garage door through a link!! Michael+1
Please log in to post a reply.
I know how to turn a LED ON using a RPC command over HTTP. For example http://<your_ip_address>/rpc/led4/write 1.
But I would like to toggle an output pin (100us ON, 200us OFF, 100us ON and so on) by using a RPC command.
How do I do this?