Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <errno.h>
- #include <wiringPiSPI.h>
- #include <unistd.h>
- using namespace std;
- // channel is the wiringPi name for the chip select (or chip enable) pin.
- // Set this to 0 or 1, depending on how it's connected.
- static const int CHANNEL = 1;
- int main()
- {
- int fd, result;
- unsigned char buffer[3];
- cout << "Initializing" << endl ;
- // Configure the interface.
- // CHANNEL insicates chip select,
- // 500000 indicates bus speed.
- fd = wiringPiSPISetup(CHANNEL, 500000);
- cout << "Init result: " << fd << endl;
- // clear display
- buffer[0] = 0xFF;
- while(1)
- {
- wiringPiSPIDataRW(CHANNEL, buffer, 1);
- sleep(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement