9 years, 10 months ago.

Superclass method not overridden???

hi, i am interfacing python with mbed LPC11U24 using serial rpc. the mbed code is as follows:

#include "mbed.h"
#include "mbed_rpc.h"

Serial pc(USBTX, USBRX);

int main() {
    // setup the classes that can be created dynamically
    RPC::add_rpc_class<RpcDigitalIn>();
    RPC::add_rpc_class<RpcDigitalOut>();    
    // receive commands, and send back the responses
    char buf[256], outbuf[256];        
    while(1) {
        pc.gets(buf, 256);
        RPC::call(buf, outbuf);
        pc.printf("%s\n", outbuf);
    }
}

while running the python code after giving this command : x = DigitalOut(mbed, LED1) i get Superclass method not overridden message. how to solve it???

Question relating to:

after looking the mbedRPC.py code i found that there is an extra indentation in the SerialRPC class where it overrides the rpc method from the mbed super class:

code snippet from mbedRPC.py

class SerialRPC(mbed):

    def __init__(self,port, baud):
        self.ser = serial.Serial(port)
        self.ser.setBaudrate(baud)


        def rpc(self, name, method, args):
                self.ser.write("/" + name + "/" + method + " " + " ".join(args) + "\n")
                return self.ser.readline().strip()

after removing the extra indentation the library started working...

posted by bhavik gala 26 Jun 2014

Thanks Bhavik, saved me a lot of time.

posted by Vandana Joglekar 16 Aug 2014

Welcome Vandana, I am a co-founder for bit2Labz which is placed in Mumbai. We are a group of students working on new interesting embedded concepts. I would really nice to know about interesting concepts you are working on using mbed.

posted by bhavik gala 16 Aug 2014
Be the first to answer this question.