Jump to content

JanY

Member
  • Posts

    59
  • Joined

  • Last visited

Awards

This user doesn't have any awards

2 Followers

Contact Methods

  • Steam
    Shiznick
  • Origin
    Bongow1
  • PlayStation Network
    Gamecontroler_

Profile Information

  • Gender
    Male
  • Location
    Belgium
  • Occupation
    student/none
  • Member title
    Junior Member

System

  • CPU
    fx-8320
  • Motherboard
    Gigabyte 990fxa-ud3
  • RAM
    Kingston HyperX 8gb 1600mhz, Cl9-9-9-27
  • GPU
    Sapphire r9 290 tri-x 4GB
  • Case
    CM HAF 932 advanced
  • Storage
    Samsung 840 evo 120gb OS, adata 256gb, WD green 1,5 tb, WD green 2 tb
  • PSU
    CM silent pro m700
  • Display(s)
    Samsung 27" 1080p
  • Cooling
    CM Hyper 612s
  • Keyboard
    Logitech G110
  • Mouse
    Razer Abyssus
  • Sound
    Sennheiser HD 518
  • Operating System
    W7 64-bit
  1. Hi guys, I need someone with javascript experience to tell me how I can fill a <ol> or <ul> element with listitems which contain values from an object array. I would appreciate if this can be done with as little code as possible and little jquery. Thanks for anyone who wants to help. this is my array : (dutch translation: naam=name, prijs=price, personeel=employees) var behandeling={ knippen:{ naam:"knippen", prijs:15, personeel:["mark","kerim","niels","jan"] }, verven:{ naam:"kleuren", prijs: 20, personeel:["mark"] }, wassen:{ naam:"wassen", prijs: 5, personeel:["mark","kerim","niels","jan"] }, brushen:{ naam:"brushen", prijs: 10, personeel:["kerim","niels"] }, permanent:{ naam:"permanent", prijs: 15, personeel:["niels","jan"] } };
  2. I have this project about spi where I will measure the value of a potentiometer with an atmega (slave) and with SPI will read out this value on a raspberry pi (master). I don't know much at all about embedded systems or even programming in itself, I'm very new to this. Both files for atmega, RPi are in C. I understand most of the atmega code but the RPi code is a different story. I know basic programming stuff like a switch, for loop, if else,... I need help with the SPI stuff or just embedded code. For instance: dummy, poll, data[4]/data[0], all the #defines. Basically I want an explanation about the RPi code, what it's supposed to do and why. Also I don't want you to try and fix or expand this code, just explain it. Thanks. Whatever I do, I'm "not permitted to upload this kind of file". Both word or winrar file doesn't work. I'll just add the code here, I suggest copy/paste into seperate files yourself. Raspberry pi code: #include <wiringPi.h>#include <stdio.h>#include <wiringPiSPI.h> #define START 8#define ACK 0x55 //0b1010101#define RDY 0x55#define NOT_RDY 0XAA //0b10101010#define IDLE 1#define POLL 2#define UNINITIALISED 0#define DUMMY 0#define ADC_START 3#define ADC_ONTVANGEN 4int main (void){ unsigned char data[4]; char kanaal=0; int status=0; wiringPiSetup(); printf("voor setup\n"); if( wiringPiSPISetup (0, 500000)==-1) { printf("Could not initialise SPI\n"); return; } else { printf("na setup\n"); status=IDLE; } for (; { printf("status= %d\n",status); switch(status) { case 0: printf("in exit\n"); exit(0); case IDLE: data[0]=POLL; status=POLL; wiringPiSPIDataRW (0,data,1); //stuur poll printf("stuur poll\n"); break; case POLL: data[0]=DUMMY; wiringPiSPIDataRW (0,data,1); //dummy versturen if (data[0]==ACK) //”!=” geeft else ipv if { status=ADC_START; printf("ACK: %d\n",data[0]); } else { printf("Niet gevonden\n"); printf("resultaat: %d\n",data[0]); status=IDLE; } break; case ADC_START: data[0]=ADC_START; wiringPiSPIDataRW (0,data,1); //start versturen status=ADC_ONTVANGEN; printf("start adc\n"); break; case ADC_ONTVANGEN: data[0]=DUMMY; wiringPiSPIDataRW (0,data,1); //dummy versturen en ADCH ontvangen printf("ADCH = %d\n",data[0]); break; default: printf("default\n"); break; } delay(1000); } } Atmega32 code: #include <avr/io.h>#include <stdlib.h>#include <avr/interrupt.h> #define START 8#define ACK 0x55#define RDY 0x55#define NOT_RDY 0XAA#define IDLE 1#define POLL 2#define UNINITIALISED 0#define DUMMY 0#define ADC_START 3#define ADC_VERSTUREN 4 void SPI_SlaveInit(void);char SPI_SlaveReceive(void);void ADC_init(void); int main(void){ SPI_SlaveInit(); ADC_init(); /*DDRD = 0b11110000;*/ /* Replace with your application code */ while (1) { /*char recieve = SPI_SlaveReceive();*/ /*SPDR =~recieve;*/ /*PORTD = recieve;*/ switch (SPDR) { case POLL: SPDR = ACK; break; case ADC_START: (1<<ADSC); break; case ADC_VERSTUREN: SPDR = ADCH; break; default: break; } }} void ADC_init(void){ ADMUX = (1<<REFS0)|(1<<ADLAR); //AVCC = ref, result left adjust ADCSRA = (1<<ADEN)|(1<<ADSC)|(1<<ADATE)|(1<<ADIE); //ADC enable, start conversie, auto trigger enable, interupt enablen sei();} ISR(ADC_vect){ SPDR = ADCH;} void SPI_SlaveInit(void){ /* Set MISO output, all others input */ DDRB = (1<<PB6); /* Enable SPI */ SPCR = (1<<SPE);} char SPI_SlaveReceive(void){ /* Wait for reception complete */ while(!(SPSR & (1<<SPIF))); /* Return data register */ return SPDR;}
  3. Thanks, that link was what I needed.
  4. What does this mean? what do they find and replace? Is that something that programmers (not me) know about? Also can you explain the values behind the defines?
  5. Hi, I need some help understanding what the #defines in the beginning of a program mean. I'm completely new to this but from seeing constants in PHP I think these are constants as well? #define START 8 #define ACK 0x55 #define RDY 0x55 #define NOT_RDY 0XAA #define IDLE 1 #define POLL 2 #define UNINITIALISED 0 #define DUMMY 0 #define ADC_START 3 #define ADC_ONTVANGEN 4 (ontvangen=receive in my language) Can anyone explain what these basically are and what the values at the end means? I added the full program should you need this in order to tell me what these #defines are/do.
  6. It's working now, I removed all the Jquery code from the HTML page so I only have the jquery google link and the link to my javascript (end of body): <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="OpdrachtJquery.js"></script> Now all the Jquery is in the javascript file: $("#button").click(function(){ var naam = document.getElementById("naam").value; var titel = document.getElementById("titel").value; var score = document.getElementById("score").value; var tekst = document.getElementById("tekst").value; var reviews = "\r\n\r\n\r\nTitel: " + titel + "\r\nScore: " + score + "\r\nReview: " + tekst + "\r\nGepost door: " + naam; document.getElementById("reviews").innerHTML += reviews; }); I have no idea if this is good use of jquery but it works fine.Thanks for the help.
  7. So instead of: $(function() { ("#button").click(function(){ $("#button").attr("onclick","Reviews()"); $("#aantal").append("een"); });}); Something like: $(function() { ("#button").click(function(){ Reviews(); $("#aantal").append("een"); });}); This doesn't work though, either it's not possible or I am doing it wrong
  8. HTML: <body> <h1>Movie-reviews</h1> <label>Naam</label><br/> <input type="text" name="naam" id="naam"><br/> <label>Titel</label><br/> <input type="text" name="titel" id="titel"><br/> <label>Score</label><br/> <input type="number" max="10" min="0" name="score" id="score"><br/> <label>Review</label><br/> <textarea id="tekst" maxlength="250" cols="50" rows="10" placeholder="type hier je opmerkingen..."></textarea><br/> <button type="button" id="button">Post review</button><br/> <p>Al meer dan </p> <p id="aantal"></p> <p> reviews geupload!</p> <pre id="reviews"> </pre> <script type="text/javascript" src="OpdrachtJquery.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(function() { ("#button").click(function(){ $("#button").attr("onclick","Reviews()"); $("#aantal").append("een"); }); }); </script> </body> </html> JAVASCRIPT: function Reviews() { var naam = document.getElementById("naam").value; var titel = document.getElementById("titel").value; var score = document.getElementById("score").value; var tekst = document.getElementById("tekst").value; var reviews = "\r\n\r\n\r\nTitel: " + titel + "\r\nScore: " + score + "\r\nReview: " + tekst + "\r\nGepost door: " + naam; return reviews; //document.getElementById("reviews").innerHTML += reviews; }
  9. EDIT: I just realised it didn't include my files, I had to browse and then confirm which i didn't see. It's telling me I can't upload it so I'll just include it in tekst.
  10. I have a small assignment for my course of javascript, we need to create any site with jquery elements in it. We haven't seen any jquery yet so we need to learn it ourselves. I've made a program which allows you to upload movie reviews. Keep in mind this is just an exercise to learn jquery and javascript. I started of making the program with only javascript and it works but now i want to change it so the onclick attribute of the button which starts the javascript function is started by a jquery click function. I also have a <p> tag which should count how many reviews have been posted starting with 0. The language on the site is dutch but it shouldn't be too hard to understand, ask me if you need translation. I would appreciate the easiest/least lines of jquery code so I can understand it myself. Thanks
  11. Me and a friend (both GNM) are looking for 2 or 3 people to play matchmaking with. We're tired of losing 2/3 of the matches because we have 3 teammates who are little kids or russians that get like 1 kill per 4 deaths avg.. Every match we have to carry and still lose. My friend got deranked to gold nova master because of it. We are both from Belgium and speak dutch natively but we talk english in game so anywhere in EU is fine. Obviously we don't want the same "bad" novas or mg's to join us but if you feel the same about solo queuing, and you want to be in a team with some basic strats and aim then play with us and decide for yourself. BTW we don't think we are the best Gold novas or anything, we're still noobs but we try to win every game and not have to worry about carrying 3 players every match. Msg me I will reply questions and give out steam profile.
  12. Instead of recommending a title in the series I'll just categorize them. 2D: Job system: FF1 FF3 FF5 non-job: FF2 FF4 FF6 3D: job system: all the shitty ones non-job: FF12 (the original anyway) FF7 FF8 FF9 FF10 I might have missed something but in my opinion 6, 7, 9, 10 are great starting points. 7 and 9 haven't aged well but if you don't mind dated graphics they are really great games.
  13. Why do I always discover these giveaways right when they end
  14. It looks like the g502 is very good but at € 80 it's pretty expensive imo, the deathadder is € 70 which is still a lot. I currently use a Razer Abyssus. Also my room isn't too hot, it's not the temperature it's just that my hands get sweaty when gaming.
×