Guys, I need help, I'm using the bcm2835 library on the Raspberry PI 3b. the program compiles normally, and runs fine on the "sudo ./teste" command line. However, when I try to run or debug from Geany, a crash occurs. I tried with QT and the same thing happens.
This is the code I'm working on:
This is the code I'm working on:
Code:
#include <stdio.h>#include <bcm2835.h> int main(int argc, char **argv){ char buf[2]; if (!bcm2835_init())return 1; bcm2835_i2c_begin(); //Start I2C operations. bcm2835_i2c_setSlaveAddress(0x20); //I2C address bcm2835_i2c_set_baudrate(100000); //1M baudrate printf("Start....\n"); while(1) { printf("Loop INI\n"); //buf[0] = 0x00; //LED ON buf[0] = 0b11111110; //LED ONbuf[1] = 0b11111110; bcm2835_i2c_write(buf,2); bcm2835_delay(500); buf[0] = 0xFF; //LED OFF buf[1] = 0xFF; //LED OFF bcm2835_i2c_write(buf,2); bcm2835_delay(500); printf("Loop EOF\n"); } bcm2835_i2c_end(); bcm2835_close(); return 0;}
Statistics: Posted by Jose_Carlos_Oliveira — Sat May 04, 2024 12:54 pm — Replies 1 — Views 19