Programski jezik "C"
Postano: ned ožu 31, 2019 9:52 pm
Arduino koristi C. Koji C: C, C++ ili C#? Ili sva tri?
e-radionica.com - Forum
https://forum.e-radionica.com:443/hr/
https://forum.e-radionica.com:443/hr/viewtopic.php?f=29&t=111
Osnovni programski jezik koji se koristi na platformi Arduino je svojevrsna pojednostavljena varijanta jezika C. Tačnije, iz jezika su sklonjene neke kompleksnije stvari i uvedena je C/C++ biblioteka zvana Wiring, koja je preuzeta iz pomenute platforme Processing. Upravo iz činjenice da je Processing pisan za jezik Java, a Wiring za C/C++ proizilaze i nevelike razlike u njihovoj sintaksi.
Kod: Označite sve
#include <Arduino.h>
int main(void)
{
init();
#if defined(USBCON)
USBDevice.attach();
#endif
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
Kod: Označite sve
class Maker_LED_Matrix_32 {
public:
Maker_LED_Matrix_32();
int begin(); //Init function.
int initLEDMatrix(); //Function sets up everything e-radionica Social Dispaly board.
void brightness(uint8_t _fontLight, uint8_t _backingLight); //Sets up font brightness and background brightness.
void message(char* msg, int _ms, int _stp, int _rep); //Writes user defined message/text on display.
void stopScroll(); //Calling this function scrolling will stop.
void resumeScroll(); //Calling this function scrolling will continue.
void deleteScroll(); //Function removes everything from screen and clears buffer.
void picture(uint8_t* p, int posX, int posY); //Function writes picture on screen (without scrolling).
void scrollPicture(uint8_t* p, int _ms, int _stp); //Function writes picture on screen with scrolling.
void scrollTxtAndPics(char* txt, uint8_t** p, uint16_t* picsPos_x, uint16_t* picsPos_y, uint8_t n, int _ms, int _stp, int _rep);
int repeatCount(); //Function return how much times message has been displayed
void picture8Bit(uint8_t* p, int xSize, int ySize, int x0, int y0, uint8_t bright); //Function that removes everything from screen and displays a 8bit gray scale image.
int wifiNetwork(const char* _ssid, const char* _pass); //Funcion connects to WLAN network.
int webPage(char* url, int _ms, int _stp, int _rep); //Function opens web page and displays text on LED matrix.
int webPageText(char* url, char* webText, int _n); //Function opens a web and saves data into a string without displayig on matrix.
int _dispMode;
};
Kod: Označite sve
Maker_LED_Matrix_32 led; //Maker LED Matrix display library constructor.
Kod: Označite sve
class demoClass {
private:
int privateVar;
public:
float c;
demoClass(int k) {
c = k;
}
};
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
https://www.arduino.cc/en/main/FAQIn fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page on the Arduino build process.